MATLAB: Continue for-loop despite matlab error

continueloopmatlab error

I want to process a number of images for data analysis. If one of the images causes a matlab error, I want the program to display a message but to continue with the analysis of the following images. So it would need to continue with the next iteration of a for loop. Is this possible and how would I do this?
Thanks, Christine

Best Answer

You could do something like
for ii = 1:n
try
% your code
catch ME
warning('Something happened');
end
end