Main Content

Simulink.data.dictionary.closeAll

关闭与所有开放数据字典的所有连接

描述

Simulink.data.dictionary.closeAllattempts to close all connections to all data dictionaries that are open. For example, if you create objects, such as万博1manbetxsimulink.data.dictionary,这是指词典,即词典是打开的。

Some commands and functions, such asSimulink.data.dictionary.cleanupWorkerCache,词典打开时无法操作。最好通过使用功能和方法(例如关闭方法万博1manbetxsimulink.data.dictionary目的。要查找打开的字典,请使用万博1manbetxsimulink.data.dictionary.getOpentictionaryPath。However, you can use this function to close all connections to all dictionaries.

您还可以使用此函数来关闭项目一部分的关闭脚本中的字典。

万博1manbetxsimulink.data.dictionary.closeall(DICSFILENAME关闭s all connections to the dictionary namedDICSFILENAME。如果打开使用此文件名称的多个词典(例如,如果字典具有不同的文件路径),则该函数将关闭所有连接到所有字典。

您无法指定DICSFILENAME作为完整的文件路径,例如'C:\temp\myDict.sldd'

例子

万博1manbetxsimulink.data.dictionary.closeall(___,,,,unsavedAction通过丢弃或保存未保存的更改来关闭与目标词典的所有连接。您可以选择是保存或丢弃所有目标词典的所有更改。

例子

全部收缩

丢弃任何未保存的更改。字典中的所有条目都恢复为最后保存的状态。

万博1manbetxsimulink.data.dictionary.closeall('-丢弃'

打开与数据词典的多个连接,进行更改,并通过丢弃未保存的更改来关闭所有连接。

在命令提示符下,通过创建一个万博1manbetxsimulink.data.dictionary指词典的对象。

For example, open the使用数据词典来管理燃油控制系统的数据示例数据字典。

openExample('万博1manbetxsimulink_automotive/underdforfuelcontsysexample'dictobj = 万博1manbetxsimulink.data.dictionary.open('sldemo_fuelsys_dd.sldd');

在模型资源管理器中显示字典

显示(dictobj)

您现在与此词典有两个连接:万博1manbetxsimulink.data.dictionary对象和模型资源管理器。

Make a change to the dictionary by adding an entry.

ddatasectobj = getection(dictobj,'Design Data');Addentry(ddatasectobj,'myEntry',5.2);

Simulink.data.dictionary.Section目的ddatasectobj是与词典的第三个连接。

关闭与字典的连接。丢弃未保存的更改。

万博1manbetxsimulink.data.dictionary.closeall('sldemo_fuelsys_dd.sldd',,,,'-丢弃'

字典不再以节点出现在模型层次结构模型资源管理器的窗格。这万博1manbetxsimulink.data.dictionary目的dictObj与词典断开连接。您不能使用词典互动Simulink.data.dictionary.Section目的ddatasectobj

清除提到字典的对象。

cleardictObjddatasectobj

输入参数

全部收缩

目标数据字典或字典的文件名,指定为字符向量。使用文件扩展名SLDD

例子:'mydict.sldd'

数据类型:char

未保存更改的动作,指定为'-丢弃'(丢弃更改)或'-节省'(保存更改)。

尖端

A data dictionary is open if any of these conditions are true:

  • 字典在模型层次结构模型资源管理器的窗格。要关闭与字典的连接,请右键单击Model Explorer中的节点,然后选择关闭。或者,使用隐藏方法万博1manbetxsimulink.data.dictionary目的。

  • 您创建了指词典的任何这些类的对象:

    • 万博1manbetxsimulink.data.dictionary

    • Simulink.data.dictionary.Section

    • Simulink.data.dictionary.Entry

    To close these connections to the dictionary, use the关闭方法的方法万博1manbetxsimulink.data.dictionary目的or clear the object. Clear theSimulink.data.dictionary.SectionandSimulink.data.dictionary.Entry对象。

  • 链接到字典的模型是打开的。要关闭与字典的连接,请关闭模型。

版本历史记录

在R2016a中引入