Main Content

Simulink.dictionary.archdata.ValueType

Specify common set of signal properties for reuse in Architectural Data section

Since R2023b

    Description

    Use a Simulink.dictionary.archdata.ValueType object to represent a Simulink.ValueType object in the Architectural Data section of a data dictionary.

    Creation

    You can add a Simulink.dictionary.archdata.ValueType object to a data dictionary in two ways.

    • Interactively create a Simulink.dictionary.archdata.ValueType object by using the Architectural Data Editor.

    • Programmatically create a Simulink.dictionary.archdata.ValueType object by using the addValueType function.

    archData = Simulink.dictionary.archdata.create("dataDictionary.sldd");
    valueType = addValueType(archData,"valueType")
    valueType = 
    
      ValueType with properties:
    
               Name: 'valueType'
           DataType: 'double'
            Minimum: '[]'
            Maximum: '[]'
               Unit: ''
         Complexity: 'real'
         Dimensions: '1'
        Description: ''
              Owner: [1×1 Simulink.dictionary.ArchitecturalData]
    

    Properties

    expand all

    Numeric type, specified as 'real' or 'complex'.

    The software ignores the value of this property when DataType specifies a Simulink.dictionary.archdata.StructType object. The software uses the corresponding properties of the Simulink.dictionary.archdata.StructElement objects in the Simulink.dictionary.archdata.StructType object instead.

    Data Types: char | string

    Data type, specified as a character vector or string scalar.

    You can specify any of these options:

    • Built-in Simulink® data type — For example, specify "single" or "uint8". See Data Types Supported by Simulink.

    • Fixed-point data type — Specify a call to the fixdt function. For example, specify "fixdt(1,16,0)".

    • Enumerated data type — Use the name of the type preceded by Enum:. For example, specify "Enum: myEnumType".

    • Custom data type — Use a MATLAB® expression that specifies the type. For example, you can specify a Simulink.dictionary.archdata.NumericType object as the data type.

      numericType = Simulink.NumericType;
      valueType.DataType = numericType
      
      valueType = 
      
        ValueType with properties:
      
                 Name: 'valueType'
             DataType: 'myNumeric'
              Minimum: '[]'
              Maximum: '[]'
                 Unit: ''
           Complexity: 'real'
           Dimensions: '1'
          Description: ''
                Owner: [1×1 Simulink.dictionary.ArchitecturalData]
    • struct (bus) data type — Use the name of a Simulink.dictionary.archdata.StructType object to set the data type as a Simulink.Bus object.

      structType = addStructType(archData,'myStruct');
      valueType.DataType = structType
      
      valueType = 
      
        ValueType with properties:
      
                 Name: 'valueType'
             DataType: 'Bus: myStruct'
              Minimum: '[]'
              Maximum: '[]'
                 Unit: ''
           Complexity: 'real'
           Dimensions: '1'
          Description: ''
                Owner: [1×1 Simulink.dictionary.ArchitecturalData]
      

      When you specify a Simulink.dictionary.archdata.StructType object as the data type, some properties of the Simulink.dictionary.archdata.ValueType object are ignored. For example, the Minimum, Maximum, and Unit properties of the Simulink.dictionary.archdata.ValueType object are ignored. The software uses the corresponding properties of the Simulink.dictionary.archdata.StructElement objects in the Simulink.dictionary.archdata.StructType object instead.

    Data Types: char | string

    Description, specified as a character vector or string scalar. Use the description to document information about the Simulink.dictionary.archdata.ValueType object, such as the kind of signal it applies to. This information does not affect Simulink processing.

    Data Types: char | string

    Dimensions of value type, specified as a scalar or vector.

    Data Types: double

    Option to allow only fixed-size or variable-size signals, specified as 'Fixed' or 'Variable', respectively.

    Data Types: char | string

    Maximum value, specified as a finite real double scalar.

    Data Types: double

    Minimum value, specified as a finite real double scalar.

    Data Types: double

    Name of the value type object, specified as a character vector or string scalar.

    Example: addValueType(archDataObj,"myValueType")

    Data Types: char | string

    Architectural Data section containing the value type, specified as a Simulink.dictionary.ArchitecturalData object.

    Example: Owner: [1×1 Simulink.dictionary.ArchitecturalData]

    Physical unit, specified as a character vector or string scalar.

    For more information, see Unit Specification in Simulink Models.

    Example: 'inches'

    Data Types: char | string

    Object Functions

    moveToDesignDataMove interfaces, data types, and constants in Architectural Data section of Simulink data dictionary to design data
    moveToDictionaryMove architectural data of Simulink data dictionary to another data dictionary
    showView architectural data of Simulink data dictionary in Architectural Data Editor
    destroyDelete data element and remove from data interface

    Examples

    collapse all

    In the MATLAB Command Window, define a reusable set of properties that correspond to wind velocity by using the Simulink.ValueType function.

    Create a ValueType object with default properties.

    windVelocity = Simulink.ValueType
    windVelocity = 
      ValueType with properties:
    
              DataType: 'double'
                   Min: []
                   Max: []
                  Unit: ''
            Complexity: 'real'
            Dimensions: 1
        DimensionsMode: 'Fixed'
           Description: ''
    
    
    

    Specify the desired property values for wind velocity.

    windVelocity.DataType = 'single';
    windVelocity.Min = 11;
    windVelocity.Max = 17;
    windVelocity.Unit = 'm/s';
    windVelocity.Description = 'Wind velocity value type'
    windVelocity = 
      ValueType with properties:
    
              DataType: 'single'
                   Min: 11
                   Max: 17
                  Unit: 'm/s'
            Complexity: 'real'
            Dimensions: 1
        DimensionsMode: 'Fixed'
           Description: 'Wind velocity value type'
    
    
    

    Create a data dictionary and use the Simulink.dictionary.ArchitecturalData object to access the Architectural Data section.

    dictName = "myDictionary.sldd";
    archData = Simulink.dictionary.archdata.create(dictName);
    

    Create a Simulink.dictionary.archdata.ValueType object that inherits the properties of windVelocity by using the addValueType function.

    archValueType = addValueType(archData,"windVelocityType",...
              "SimulinkValueType",windVelocity)
    
    archValueType = 
    
      ValueType with properties:
    
               Name: 'windVelocityType'
           DataType: 'single'
            Minimum: '11'
            Maximum: '17'
               Unit: 'm/s'
         Complexity: 'real'
         Dimensions: 1
        Description: 'Wind velocity value type'
              Owner: [1×1 Simulink.dictionary.ArchitecturalData]
    

    Version History

    Introduced in R2023b