Close the prompt to save simulink model using Matlab code

2 ビュー (過去 30 日間)
Seshasai Seera
Seshasai Seera 2021 年 1 月 4 日
コメント済み: Uday Pradhan 2021 年 1 月 7 日
I am working on FOR loop, where simulink model will be run in a separate matlab window and closed using !taskkill \pid . In one of the simulink model file, I am getting a message prompt saying 'Save "Simulink Model" before closing' 1. Yes 2. No 3. Cancel.
I donot want to save the model. So, I had to click 2.No everytime.
  1. Is it possible to select 2.No everytime?.
  2. It is even better if you can suggest a way to avoid getting such a prompt, by changing some settings.

採用された回答

Uday Pradhan
Uday Pradhan 2021 年 1 月 7 日
Hi Seshasai,
You could use the "/f" parameter with taskkill to forcefully terminate the process. Ofcourse, the changes made to that process will not be saved in this case. For example:
!taskkill /pid 13768 /f
If you want to run and close Simulink models in the same MATLAB instance, I suggest using the "bdclose" function which ignores the "Save" dialog box and reverts any changes before closing the model. Documentation link: bdclose
  2 件のコメント
Seshasai Seera
Seshasai Seera 2021 年 1 月 7 日
Thanks!! using /f has worked for me.
Uday Pradhan
Uday Pradhan 2021 年 1 月 7 日
Great! Do accept my answer so that it helps other community members who might have similar doubts, thanks!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by