Azzera filtri
Azzera filtri

skiping code after line 20

3 visualizzazioni (ultimi 30 giorni)
Arunachalam  D
Arunachalam D il 4 Lug 2015
Risposto: Image Analyst il 4 Lug 2015
Skip the coding after line 20 in script window

Risposte (2)

Walter Roberson
Walter Roberson il 4 Lug 2015
MATLAB has no "goto". If you are inside a function you can skip the rest of the function by using "return". If you are inside a "for" or "while" loop, you can use "break" to leave the loop.

Image Analyst
Image Analyst il 4 Lug 2015
You can put in this line for line 20 to skip running lines after line #20:
return; % Exit the script
You will get an orange squiggle under line 21 saying that "This statement (and possibly the following ones) cannot be reached." though you already know that so you can ignore the warning - your code will still run through line 20.

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by