MATLAB: Skip Error Message and Continue with the M-File

algofinanceintenretMATLAByahoo finance

Hello dear Friends,
does someone know how to have a m-file to continue after an error message is returned !?
I've a file that retrives info from the internet (data, etc.). Sometimes (randomly) an internet connection problem results (error 111) and matlab stops to execute the m-file algo! Since this files connects to more than 5000 web pages (one per time) it is possible that a connection error is returned in matlab.
I simply want the program to resume the operations specified in the m-file.
does someone know how to do this?
thank you for your help …

Best Answer

Completing Gerd's answer, I would include the catch statement. The catch executes everytime an error is encountered in the try block, so maybe not display an error message that stops the execution, but maybe a message in console to know that something went wrong (execution will continue anyway):
try
% Code to be executed goes here.
catch
disp('An error occurred while retrieving information from the internet.');
disp('Execution will continue.');
end