Main Content

addAliasType

Add Simulink alias type to Architectural Data section of Simulink data dictionary

Since R2023b

    Description

    example

    dataType = addAliasType(archDataObj,dataTypeName) adds a Simulink.AliasType specified by dataTypeName to archDataObj.

    example

    dataType = addAliasType(archDataObj,dataTypeName,BaseType=baseType) adds a Simulink.AliasType specified by dataTypeName using the specified base type to archDataObj.

    Examples

    collapse all

    To add a Simulink.AliasType with a specified name to the data dictionary, use the addAliasType function. For an example that shows more of the workflow for related functions, see Create Architectural Data Object and Use It to Configure Architectural Data.

    Create or open a data dictionary. This example uses a previously created data dictionary MyInterfaces.sldd.

    dictName = "MyInterfaces.sldd";
    archDataObj = Simulink.dictionary.archdata.open(dictName);
    

    Add alias types using the addAliasType function. Specify the name, and base type using either input arguments of the function or the created alias type object.

    myAliasType1 = addAliasType(archDataObj,'aliasType',BaseType="single");
    myAliasType1.Name = "myAliasType1";
    myAliasType1.BaseType = 'fixdt(1,32,16)';
     
    myAliasType2 = addAliasType(archDataObj,'myAliasType2');
    

    You can use alias type objects as the base types of other objects.

    myAliasType2.BaseType = myAliasType1;

    Input Arguments

    collapse all

    Architectural Data object, specified by Simulink.dictionary.ArchitecturalData object.

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

    Example: "airSpeed"

    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 object, returned as a Simulink.dictionary.archdata.AliasType object.

    Version History

    Introduced in R2023b