Main Content

addDataInterface

Add a data interface to Simulink Interface Dictionary

Description

example

interfaceObj = addDataInterface(dictObj,interfaceName) adds a data interface with the specified name in the dictionary. Returns the interface object that represents this interface.

Examples

collapse all

To add a data interface with the specified name that mirrors the specified bus object, use the addDataInterface function. For an example that shows more of the workflow for related functions, see Create and Configure Interface Dictionary.

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');

Input Arguments

collapse all

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

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

Example: 'DataInterface'

Output Arguments

collapse all

Data interface, returned as a DataInterface object.

Version History

Introduced in R2022b