Main Content

addAliasType

Add Simulink alias type to Simulink interface dictionary

Since R2022b

Description

example

dataType = addAliasType(dictObj,dtName) adds a Simulink.AliasType with the specified name to the dictionary.

example

dataType = addAliasType(dictObj,dtName,BaseType=baseType) adds a Simulink.AliasType with the specified name using the specified base type to the dictionary.

Examples

collapse all

To add a Simulink.AliasType with the specified name to the dictionary, use the addAliasType function. For an example that shows more of the workflow for related functions, see Create and Configure Interface Dictionary.

% open interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.open(dictName);

% add alias types
myAliasType1 = addAliasType(dictAPI,'aliasType',BaseType='single');
myAliasType1.Name = 'myAliasType1';
myAliasType1.BaseType = 'fixdt(1,32,16)';
 
myAliasType2 = addAliasType(dictAPI,'myAliasType2');
% can also use interface dict type objs
myAliasType2.BaseType = myAliasType1;

Input Arguments

collapse all

Interface dictionary, specified as a Simulink.interface.Dictionary object. Before you use this function, create or open dictObj by using Simulink.interface.dictionary.create or Simulink.interface.dictionary.open.

DataType definition name in DataTypes property array of dictObj, specified as a character vector or a string scalar.

Example: "airSpeed"

Name of the base data type that this alias renames, specified as a character vector or string scalar. You can specify the name of a standard data type, such as "uint32" or "single", or the name of a custom data type, such as the name of another Simulink.AliasType object, or the name of an enumeration.

Example: BaseType='uint32'

Output Arguments

collapse all

Alias type, returned as a Simulink.interface.dictionary.AliasType object.

Version History

Introduced in R2022b

expand all