Main Content

addValueType

Add value type to Architectural Data section of Simulink data dictionary

Since R2023b

    Description

    dataType = addValueType(archDataObj,dataTypeName) adds a Simulink.dictionary.archdata.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.

    example

    Examples

    collapse all

    To add a Simulink.dictionary.archdata.ValueType object 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 Store Data in Architectural Data Section Programmatically.

    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 Simulink.dictionary.archdata.ValueType object 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 Simulink.dictionary.archdata.ValueType object that inherits signal properties from an existing Simulink.ValueType object 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 Simulink.dictionary.archdata.ValueType object to the Architectural Data section of the data dictionary that inherits signal properties from the Simulink.ValueType object simValueType.

    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