MATLAB Answers

how to disable the CLI prompt to save simulink model before closing?

4 views (last 30 days)
jessupj
jessupj on 31 Aug 2020
Answered: Uday Pradhan on 7 Jan 2021
I'm calling simulink through non-GUI shell. Any error or interruption of the model (eg. Ctrl+c) seems to bring up an infinite and difficult-to-interrupt-over-remote-session prompt of the form:
----- Save "simulink_model" before closing? -----
1) Yes
2) No
3) Cancel
because i've made changes to the model configuration settings. I would like to just completely disable this behavior in the terminal wihtout disabling auto-save features in the GUI editor. I have statements like
try
% open/configure/run the model
catch
close_system(gcs,0)
end
to avoid this prompt from inside matlab, but those don't handle interruption of the matlab process from the shell.
This has probably been asked before, but I can't find it based on what i'm querying.

Answers (1)

Uday Pradhan
Uday Pradhan on 7 Jan 2021
Hi,
If you want to save your changes, may be you could use "save_system" command in your try block. In this way, when you close the model, the prompt to save the model should no longer appear. You could also check out the "bdclose" command to close the model from command line, this doesn't trigger the Save model dialog but reverts unsaved changes.

Community Treasure Hunt

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

Start Hunting!