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
Post a Comment