Main Content

addNumericType

Add Simulink numeric type to Simulink interface dictionary

Since R2023a

Description

example

dataType = addNumericType(dictObj,dtName) adds a Simulink.NumericType with the specified name to the dictionary.

example

dataType = addNumericType(dictObj,dtName,SimulinkNumericType=numericTypeObj) adds a Simulink.NumericType with the specified name that has the same property values as the specified Simulink.NumericType object numericTypeObj to the dictionary.

.

Examples

collapse all

To add a Simulink.NumericType with the specified name to the dictionary, use the addNumericType function.

dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
myNumericType = addNumericType(dictAPI,'myNumericType1')
myNumericType = 

  NumericType with properties:

                Name: 'myNumericType1'
        DataTypeMode: 'Double'
    DataTypeOverride: 'Inherit'
             IsAlias: 0
         Description: ''
               Owner: [1×1 Simulink.interface.Dictionary]

To add a Simulink.NumericType that has the same property values as an existing Simulink.NumericType to the dictionary, use the addNumericType function with the SimulinkNumericType parameter.

exampleNumericTypeObj = Simulink.NumericType;
exampleNumericTypeObj.DataTypeMode = 'Single';
exampleNumericTypeObj.Description = 'This is my example numeric type';

dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
myNumericType2 = addNumericType(dictAPI,'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.interface.Dictionary]

Input Arguments

collapse all

Interface dictionary, specified as a Simulink.interface.Dictionary object. Before you use this function, create or open dictObj by using Simulink.interface.dictionary.create or Simulink.interface.dictionary.open.

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

Example: "airSpeed"

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

Example: SimulinkNumericType=exampleSimulinkNumericTypeObj

Output Arguments

collapse all

Numeric type, returned as Simulink.interface.dictionary.NumericType object.

Version History

Introduced in R2023a

expand all