フィルターのクリア

How to Stop an M File?

18 ビュー (過去 30 日間)
Mahmoud Rashidi
Mahmoud Rashidi 2017 年 3 月 10 日
回答済み: John Chilleri 2017 年 3 月 10 日
I have several functions in an M File:
function myfun1
myfun2
end
function myfun2
myfun3
end
How can I stop executing a specific function and exit the script?
  1 件のコメント
John Chilleri
John Chilleri 2017 年 3 月 10 日
Do you mean other than using control + C?

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

採用された回答

John Chilleri
John Chilleri 2017 年 3 月 10 日
Hello,
You can use return in your script and function to exit.
For example,
function output = blah(input)
if input == 5
output = 1;
return
end
...
end
With a script:
...
output = blah(input)
if output == 1
return
end
...
So in summary, you can use return just as you might in a function.
Hope this helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by