主要内容

本页采用了机器翻译。点击此处可查看英文原文。

addInterface

在数据字典中创建命名数据接口

说明

interface = addInterface(dictionary,name) 将名称 name 指定的数据接口添加到数据字典 dictionary 中。

要删除接口,请使用 removeInterface 函数。

示例

interface = addInterface(dictionary,name,SimulinkBus=busObject) 构造了一个与现有 Simulink® 总线对象镜像的数据接口。

示例

示例

全部折叠

创建数据字典,然后添加数据接口 newInterface

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

创建一个新模型,并将数据字典链接到该模型。然后,打开接口编辑器以查看新接口。

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

创建一个数据字典。

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

创建一个 Simulink.Bus 对象。

busObj = Simulink.Bus;

用两个元素填充总线对象。

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

在数据字典中添加镜像总线对象的命名数据接口。

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

创建一个新模型,并将数据字典链接到该模型。然后,打开接口编辑器以查看新接口。

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

输入参数

全部折叠

数据字典,指定为 systemcomposer.interface.Dictionary 对象。有关如何创建数据字典的信息,请参阅 createDictionary

新数据接口的名称,指定为字符向量或字符串。该名称必须是有效的 MATLAB® 标识符。

示例: "newInterface"

数据类型: char | string

新数据接口镜像的 Simulink 总线对象,指定为 Simulink.Bus 对象。

输出参量

全部折叠

新数据接口,以 systemcomposer.interface.DataInterface 对象的形式返回。

详细信息

全部折叠

版本历史记录

在 R2019a 中推出

另请参阅

函数

对象

模块

工具