フィルターのクリア

Check if Simulink is started (for faster use of find_system)

11 ビュー (過去 30 日間)
dbmn
dbmn 2016 年 9 月 6 日
回答済み: Malcolm Wood 2021 年 6 月 10 日
I have a function that calls
find_system('SearchDepth',0);
to check if there are any Simulink elements. As expected, if no models are open, it returns an empty cell array.
BUT Matlab spends ages (about 5 seconds) while "Starting Simulink...". I could omit the check if I knew that Simulink was not started and save the 5 Seconds.
  • Is there a way to programmatically check if Simulink is already started?

採用された回答

dbmn
dbmn 2016 年 9 月 7 日
I found a workaround that I wanted to share
% check if Simulink was started in the past
current_licenses = license('inuse');
if strcmp('simulink', current_licenses)
% code that calls findsystem
end
It is not the nicest way to check if simulink has been started in the past by checking the currently used licenses on the machine - but it works most of the time.
Attention: by doing this you will not catch any timeouts that might occur when you are using a server based license.

その他の回答 (1 件)

Malcolm Wood
Malcolm Wood 2021 年 6 月 10 日
Since R2020b there's a function called isSimulinkStarted which tells you whether the "Starting Simulink..." process has already run - which, as you've seen, isn't quite the same as whether a license has been checked out.

カテゴリ

Help Center および File ExchangeNaming Conventions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by