How can I skip right to the end of a script?

35 ビュー (過去 30 日間)
Bogdan
Bogdan 2016 年 4 月 13 日
コメント済み: Bogdan 2016 年 4 月 14 日
Hello!
I have a problem with a MATLAB script which I don't know how to fix it.
I am in the middle of the script and I need for it to jump straight to the end of it. There is no equivalent for goto in MATLAB so this is out of the question and, right now, rewriting the code is not an option.
A piece of the source is this:
if (i==m_sonde-1)
(....)
BC=sqrt((YB-YC)*(YB-YC)+(XB-XC)*(XB-XC));
BPBC=sqrt((YB-yPBC)*(YB-yPBC)+(XB-xP)*(XB-xP));
vPBC=vB+BPBC/BC*(vC-vB);
% *Here* I need to exit the program
end
How do I do it?

採用された回答

Kuifeng
Kuifeng 2016 年 4 月 13 日
help break %does this help?
  3 件のコメント
Kuifeng
Kuifeng 2016 年 4 月 14 日
Thank you Jeremy.
Bogdan
Bogdan 2016 年 4 月 14 日
Yes, "return" was the correct answer.
Thank you very much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by