Main Content


Manage interface dictionary

Since R2022b


    The Simulink.interface.Dictionary object provides methods that help you manage the interface dictionary.


    To create a Simulink interface dictionary and return an object representing the dictionary, use the Simulink.interface.dictionary.create function.

    dictName = 'MyInterfaces.sldd';
    dictAPI = Simulink.interface.dictionary.create(dictName);

    If you already created an interface dictionary, you can create a Simulink.interface.dictionary object to represent the existing dictionary by using the function.

    dictAPI ='MyInterfaces.sldd');


    expand all

    Data types defined in dictionary, specified as an array of DataType objects with properties: Name and Owner.

    File name of SLDD file associated with the dictionary.

    Interfaces defined in dictionary, specified as an array of DataInterface and ServiceInterface objects with properties: Name, Description, Elements, and Owner.

    Object Functions

    addAliasTypeAdd Simulink alias type to Simulink interface dictionary
    addDataInterfaceAdd data interface to Simulink interface dictionary
    addEnumTypeAdd enumerated type to Simulink interface dictionary
    addNumericTypeAdd Simulink numeric type to Simulink interface dictionary
    addPlatformMappingAdd AUTOSAR Classic mapping to Simulink interface dictionary
    addReferenceAdd Simulink interface dictionary reference to another interface dictionary
    addServiceInterfaceAdd service interface to Simulink interface dictionary
    addStructTypeAdd structure type represented by Simulink.Bus in Simulink interface dictionary
    addValueTypeAdd value type to Simulink interface dictionary
    closeClose open connections to Simulink interface dictionary
    discardChangesDiscard changes to interface dictionary
    findEntryByNameGet corresponding object for specified entry name in interface dictionary
    getDataTypeGet data type in Simulink interface dictionary
    getDataTypeNamesGet names of data types in Simulink interface dictionary
    getInterfaceGet interface object for interface in Simulink interface dictionary
    getInterfaceNamesGet cell array of interface names in Simulink interface dictionary
    getPlatformMappingGet platform mapping object for platform in dictionary
    getReferencesGet cell array of names of interface dictionaries that are referenced by another interface dictionary
    importFromBaseWorkspaceImport Simulink object definitions
    importFromFileImport Simulink object definitions
    isDirtyCheck whether there are unsaved changes in Simulink interface dictionary
    removeDataTypeRemove data type from Simulink interface dictionary
    removeInterfaceRemove interface from Simulink interface dictionary
    removeReferenceRemove Simulink interface dictionary reference from another interface dictionary
    saveSave changes to Simulink interface dictionary
    showView contents of Simulink interface dictionary in standalone viewer
    showChangesView changes to contents of Simulink interface dictionary in comparison viewer


    collapse all

    This example creates a Simulink.interface.dictionary object and configures the dictionary contents. This example also shows how to manage AUTOSAR Classic platform-related elements.

    Create an interface dictionary.

    dictName = 'MyInterfaces.sldd';
    dictAPI = Simulink.interface.dictionary.create(dictName);

    Add data types.

    % Alias Types
    myAliasType1 = addAliasType(dictAPI,'aliasType',BaseType='single');
    myAliasType1.Name = 'myAliasType1';
    myAliasType1.BaseType = 'fixdt(1,32,16)';
    myAliasType2 = addAliasType(dictAPI,'myAliasType2');
    % can also use interface dict type objs
    myAliasType2.BaseType = myAliasType1;
    % Enum Type
    myEnumType1 = addEnumType(dictAPI,'myColor');
    myEnumType1.addEnumeral('RED','0','Solid Red');
    myEnumType1.addEnumeral('BLUE','1','Solid Blue');
    myEnumType1.DefaultValue = 'BLUE';
    myEnumType1.Description = 'I am a Simulink Enumeration';
    myEnumType1.StorageType = 'int16';
    % set base type of an alias type to be this enum object
    myAliasType3 = addAliasType(dictAPI,'myAliasType3');
    myAliasType3.BaseType = myEnumType1;
    % Value Type
    myValueType1 = addValueType(dictAPI,'myValueType1');
    myValueType1.DataType = 'int32';
    myValueType1.Dimensions = '[2 3]';
    myValueType1.Description = 'I am a Simulink ValueType';
    myValueType1.DataType = myEnumType1; % can also use interface dict type objs
    % Struct Type
    myStructType1 = addStructType(dictAPI,'myStructType1');
    structElement1 = myStructType1.addElement('Element1');
    structElement1.Type.DataType = 'single';
    structElement1.Type.Dimensions = '3';
    structElement2 = myStructType1.addElement('Element2');
    structElement2.Type = myValueType1;
    % or
    structElement2.Type = 'ValueType: myValueType1';
    % Nested Struct Type
    myStructType2 = addStructType(dictAPI,'myStructType2');
    myStructType2.Description = 'I am a nested structure';
    structElement = myStructType2.addElement('Element');
    structElement.Dimensions = '5';
    structElement.Type = myStructType1;
    % or
    structElement.Type = 'Bus: myStructType1';

    Add interfaces and configure design data on data elements.

    dataInterface1 = addDataInterface(dictAPI,'DataInterface');
    dataElm1 = addElement(dataInterface1,'DE1');
    dataElm1.Type = myValueType1;
    dataElm2 = addElement(dataInterface1,'DE2');
    dataElm2.Type = myStructType2;
    dataElm2.Dimensions = '4';
    dataElm2.Description = 'I am a data element with datatype = array of struct type';
    % data element with owned type
    dataElm3 = addElement(dataInterface1,'DE3');
    dataElm3.Type.DataType = 'single';
    dataElm3.Type.Dimensions = '10';
    dataElm3.Type.Minimum = '-5';
    dataInterface2 = addDataInterface(dictAPI,'DataInterface2');

    Add AUTOSAR Classic mapping.

    platformMapping = addPlatformMapping(dictAPI,'AUTOSARClassic');

    Set AUTOSAR communication interface and package properties.


    Get the platform-specific properties.

    [pNames, pValues] = getPlatformProperties(platformMapping,dataInterface1);

    Manage AUTOSAR Classic platform-related elements, SwAddrMethod and calibration properties. These elements do not have mapping to Simulink.

    arObj = autosar.api.getAUTOSARProperties(dictName);
    addPackageableElement(arObj,'SwAddrMethod', ... 
    setPlatformProperty(platformMapping,dataElm1, ...

    Version History

    Introduced in R2022b

    expand all