Exit Matlab from a Simulnk callback function

15 ビュー (過去 30 日間)
Thomas Kotwal
Thomas Kotwal 2019 年 5 月 31 日
回答済み: Arvind Sathyanarayanan 2019 年 5 月 31 日
Is there any way to close Matlab from a callback function of a Simulink block?
Here's the full story: We use Simulink for code generation and the build script gets called by double clicking on a particular block. The OpenFcn callback for that block runs the build script. We share a networked Matlab coder license among a number of engineers and the only way I know how to release the license after building the project is to close Matlab. People frequently forget to do that, which means they hold on to the license and prevent other people from using it. This is especially problematic if the person with the license leaves work or is otherwise out of touch.
I'd like the build script to include a dialog box which asks the user if they want to close Matlab after building. The script itself works fine, but if I call the script using the Simulink block's callback function, I get an error message saying that you can't close the Simulink model while processing a callback.

採用された回答

Arvind Sathyanarayanan
Arvind Sathyanarayanan 2019 年 5 月 31 日
Using the quit force command will let you overcome the error. Please make sure you save everything you need before running the command. It will also bypass finish.m

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Environment Customization についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by