Main Content

addValueType

Add value type to Architectural Data section of Simulink data dictionary

Since R2023b

    Description

    example

    dataType = addValueType(archDataObj,dataTypeName) adds a Simulink.ValueType specified as dataTypeName to archDataObj, the Architectural Data section of the data dictionary.

    example

    dataType = addValueType(archDataObj,dataTypeName,SimulinkValueType=valueTypeObj) adds a value type based on the specified Simulink.ValueType valueTypeObj to the data dictionary.

    Examples

    collapse all

    To add a Simulink.ValueType with a specified name to the data dictionary, use the addValueType 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 adds a value type to the data dictionary MyInterfaces.sldd.

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

    Add a value type to the Architectural Data section of a data dictionary. You can set the data type, dimensions, and define a description of the created value type.

    myValueType1 = addValueType(archDataObj,"myValueType1");
    myValueType1.DataType = 'int32';
    myValueType1.Dimensions = '[2 3]';
    myValueType1.Description = "I am a Simulink ValueType";

    This example adds a value type that is the same as an existing Simulink.ValueType to the Architectural Data section of a data dictionary, MyInterfaces.sldd.

    Create or open a data dictionary.

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

    Create and define a Simulink.ValueType object.

    simValueType = Simulink.ValueType;
    simValueType.DataType = 'single';
    simValueType.Min = 11;
    simValueType.Max = 17;
    simValueType.Dimensions = [2 4 3];
    simValueType.Description = 'Simulink value type';
    

    Using the addValueType function you can add a value data type to the Architectural Data section of the data dictionary that is based on the Simulink.ValueType object created in the previous step.

    myNewValueType1 = addValueType(archDataObj, 'MyNewValueType',...
       SimulinkValueType=simValueType)
    
    myNewValueType1 = 
    
      ValueType with properties:
    
               Name: 'MyNewValueType'
           DataType: 'single'
            Minimum: '11'
            Maximum: '17'
               Unit: ''
         Complexity: 'real'
         Dimensions: '[2 4 3]'
        Description: 'Simulink value type'
              Owner: [1×1 Simulink.dictionary.ArchitecturalData]

    Input Arguments

    collapse all

    Architectural Data object, specified as a Simulink.dictionary.ArchitecturalData object.

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

    Example: "airSpeed"

    Value type object, specified as a Simulink.ValueType object.

    Output Arguments

    collapse all

    Value type object, returned as Simulink.dictionary.archdata.ValueType object.

    Version History

    Introduced in R2023b