Main Content


Add value type to Simulink interface dictionary

Since R2022b



dataType = addValueType(dictObj,dtName) adds a Simulink.ValueType with the specified name to the interface dictionary.


dataType = addValueType(dictObj,dtName, SimulinkValueType=valueTypeObj) adds a value type, specified as dataType, with the specified name, dtName, based on the specified Simulink.ValueType valueTypeObj to the interface dictionary.


collapse all

To add a Simulink.ValueType with the specified name to the dictionary, use the addValueType function. For an example that shows more of the workflow for related functions, see Create and Configure Interface Dictionary.

% open interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI =;

% add an enumerated type to be used as data type of value type
myEnumType1 = addEnumType(dictAPI,'myColor');
myEnumType1.addEnumeral('RED', '0', 'Solid Red');
myEnumType1.addEnumeral('BLUE', '1', 'Solid Blue');
myEnumType1.StorageType = 'int16';

% add value type
myValueType1 = addValueType(dictAPI, 'myValueType1');
myValueType1.DataType = 'int32';
myValueType1.Dimensions = '[2 3]';
myValueType1.Description = 'I am a Simulink ValueType';
myValueType1.DataType = myEnumType1;

This example adds a value type that mirrors an existing Simulink.ValueType to the Simulink interface dictionary, MyInterfaces.sldd.

% open interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI =;

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

% add value type based on Simulink value type
myNewValueType1 = addValueType(dictAPI, 'MyNewValueType',...
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.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

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

Example: "airSpeed"

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

Output Arguments

collapse all

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

Version History

Introduced in R2022b

expand all