Is it possible to stop or interrupt a code in MATLAB if a condition is reached and end the simulation of the program code ? -


is possible stop or interrupt code in matlab if condition reached , end simulation of program code ? eg have loop involves calculating parameter , moment value becomes complex no. code stop executing , return value of counter @ parameter value became complex.

yes, possible. if want exit script, can use this:

if complex(parameter)     disp(counter);     return; end 

if want exit function , return value of counter caller, can use this:

if complex(parameter)     return(counter) end 

if want break out of loop, use this:

for ...     if complex(parameter)         break;     end end print(counter) 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -