know the number of open unsaved(dirty) simulink files

1 回表示 (過去 30 日間)
João
João 2022 年 7 月 15 日
コメント済み: João 2022 年 7 月 18 日
I'm trying to know the number o unsaved files that I have open in my simulink model. I have several open , and the function (strcmp(get_param(gcs,'Dirty'),'on')), is good but only gives me the current unsaved file, if I have more than 1 it doesn't help.
I'm looking for something that does the same think as this:
function saveall_m_files()
service = com.mathworks.mlservices.MLEditorServices;
% Get a vector of all open editors
editors = service.getEditorApplication.getOpenEditors();
% For each editor, if it is dirty, save it
for k = 0:(editors.size - 1)
editor = editors.get(k);
% disp(editor)
if editor.isDirty()
editor.save();
end
end
end
But for slx files, does enyone have any idea?

採用された回答

Fangjun Jiang
Fangjun Jiang 2022 年 7 月 18 日
編集済み: Fangjun Jiang 2022 年 7 月 18 日
bd=find_system('type','block_diagram','dirty','on')
  1 件のコメント
João
João 2022 年 7 月 18 日
Thanks ! It works fine!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by