How to Stop an M File?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mahmoud Rashidi
am 10 Mär. 2017
Beantwortet: John Chilleri
am 10 Mär. 2017
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 Kommentar
Akzeptierte Antwort
John Chilleri
am 10 Mär. 2017
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!