webread exiting because of bad internet connection - how to continue the program automatically

1 view (last 30 days)
I am using webread to read data from an API. I have around 5000 links that I need to process. And my internet connection drops very often.
When the connection drops, my program exits saying, The IP address of "api.xyz.com" could not be determined.
then I have to run the code again. But how can I do this automatically. I want the code to just retry on its own instead of exiting completely.
please help!

Accepted Answer

dpb
dpb on 23 Jun 2018
See the section on Exception Handling in the documentation...specifically,
doc try
doc catch
  2 Comments
vipin
vipin on 23 Jun 2018
Ok. I used this and it worked.
I created a while loop to read the links one by one and,
try
b = webread(a,options);
catch
continue;
end
With this I was able to make the code try and retry automatic without exiting the program.
Thanks.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!