Returning from functions in debugging mode

6 ビュー (過去 30 日間)
Jonas Rosegren
Jonas Rosegren 2019 年 8 月 8 日
コメント済み: Jonas Rosegren 2019 年 8 月 17 日
Hi,
Does anyone know how to force an early return to the caller from a function while in debug mode?
I have a main program calling "plug-in" m-scripts, and while developing these m-script you sometimes (quite often actually) come across bugs in the script, which forces you to quit the main program with all its previous calculations and all.
I would like to find a way of entering "return" in the command prompt to return to the main program and escape the function. Then I can update the script and clear the function from the memory and call it again without quiting the main program, which would be a great help.
Anyone experienced similar problem?
Jonas

採用された回答

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi 2019 年 8 月 14 日
You cannot force return from a function using MATLAB. But if your script files have an error you can use ‘try-catch’ blocks where you can place a ‘return’ statement in the catch block
  1 件のコメント
Jonas Rosegren
Jonas Rosegren 2019 年 8 月 17 日
Hi,
Yes thanks, I did that, plus purge the function out of the memory so I can edit it before I call it next time, so that works well now. Still it would be "nice to have" a possibility to just force a return to the caller. Maybe it isn't possible,
Jonas

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by