MATLAB: How i have reaction against error received of matlab

no tags

i have a for loop with a condition on receive or not receive a error of matlab program, how i can have this condition?

Best Answer

for variable = first : last
got_error = true;
try
do something risky here
got_error = false; %only gets here if the risky thing worked
catch ME
do something about the error; the details of it are in ME
end
if got_error
we had an error and did something with it but maybe we want to know that later
end
end