Main Content

addNumericType

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

Since R2023b

    Description

    dataType = addNumericType(archDataObj,dataTypeName) adds a Simulink.dictionary.archdata.NumericType specified by dataTypeName to archDataobj, the Architectural Data section of the data dictionary.

    example

    dataType = addNumericType(archDataObj,dataTypeName,SimulinkNumericType=numericTypeObj) adds a Simulink.dictionary.archdata.NumericType that has the same property values as the specified Simulink.NumericType object numericTypeObj.

    example

    Examples

    collapse all

    To add a numeric data type with a specified name to the data dictionary, use the addNumericType 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.

    archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd");
    myNumericType = addNumericType(archDataObj,"myNumericType1")
    myNumericType = 
    
      NumericType with properties:
    
                    Name: 'myNumericType1'
            DataTypeMode: 'Double'
        DataTypeOverride: 'Inherit'
                 IsAlias: 0
             Description: ''
                   Owner: [1×1 Simulink.dictionary.ArchitecturalData]
    

    To add a numeric data type that has the same property values as an existing Simulink.NumericType data type to the data dictionary, use the addNumericType function specifying the SimulinkNumericType name-value argument.

    exampleNumericTypeObj = Simulink.NumericType;
    exampleNumericTypeObj.DataTypeMode = 'Single';
    exampleNumericTypeObj.Description = 'This is my example numeric type';
    
    archDataObj = Simulink.interface.dictionary.open('MyInterfaces.sldd');
    myNumericType2 = addNumericType(archDataObj,'myNumericType2',...
       SimulinkNumericType=exampleNumericTypeObj)
    myNumericType2 = 
    
      NumericType with properties:
    
                    Name: 'myNumericType2'
            DataTypeMode: 'Single'
        DataTypeOverride: 'Inherit'
                 IsAlias: 0
             Description: 'This is my example numeric type'
                   Owner: [1×1 Simulink.dictionary.ArchitecturalData]

    Input Arguments

    collapse all

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

    Data type definition name of archDataObj, specified as a character vector or a string scalar.

    Example: "airSpeed"

    Simulink numeric data type object, specified as a Simulink.dictionary.archdata.NumericType object that has been previously defined.

    Example: SimulinkNumericType=exampleSimulinkNumericTypeObj

    Output Arguments

    collapse all

    Numeric data type object, returned as Simulink.dictionary.archdata.NumericType object.

    Version History

    Introduced in R2023b