Main Content

addInterface

Create named data interface in data dictionary

Description

interface = addInterface(dictionary,name) adds the data interface specified by name name to the data dictionary dictionary.

To remove an interface, use the removeInterface function.

example

interface = addInterface(dictionary,name,SimulinkBus=busObject) constructs a data interface that mirrors an existing Simulink® bus object.

example

Examples

collapse all

Create a data dictionary, then add a data interface newInterface.

dictionary = systemcomposer.createDictionary("new_dictionary.sldd");
interface = addInterface(dictionary,"newInterface")

Create a new model and link the data dictionary to the model. Then, open the Interface Editor to view the new interface.

arch = systemcomposer.createModel("newModel");
systemcomposer.openModel("newModel");
linkDictionary(arch,"new_dictionary.sldd");

Create a data dictionary.

dictionary = systemcomposer.createDictionary("new_dictionary.sldd");

Create a Simulink.Bus object.

busObj = Simulink.Bus;

Populate the bus object with two elements.

busObj = Simulink.Bus;
elems(1) = Simulink.BusElement;
elems(1).Name = 'element_1';
elems(2) = Simulink.BusElement;
elems(2).Name = 'element_2';
busObj.Elements = elems;

Add the named data interface that mirrors the bus object to the data dictionary.

interface = addInterface(dictionary,"newInterface",SimulinkBus=busObj);

Create a new model and link the data dictionary to the model. Then, open the Interface Editor to view the new interface.

arch = systemcomposer.createModel("newModel");
systemcomposer.openModel("newModel");
linkDictionary(arch,"new_dictionary.sldd");

Input Arguments

collapse all

Data dictionary, specified as a systemcomposer.interface.Dictionary object. For information on how to create a data dictionary, see createDictionary.

Name of new data interface, specified as a character vector or string. This name must be a valid MATLAB® identifier.

Example: "newInterface"

Data Types: char | string

Simulink bus object that new data interface mirrors, specified as a Simulink.Bus object.

Output Arguments

collapse all

New data interface, returned as a systemcomposer.interface.DataInterface object.

More About

collapse all

Version History

Introduced in R2019a

See Also

Functions

Objects

Blocks

Tools