Error using load? Unable to read file

1 view (last 30 days)
I have a question about load file. for example load laserdata and laserdata file is not there is there a way to return 0? for no file exist rather than error? I tried exist function in matlab but no luck?
Any help will be great

Accepted Answer

Ingrid on 14 Jul 2015
you could use a try - catch block
load laserdata
% write whatever code you want to be executed if the laserdata cannot be loaded
  1 Comment
Hesham Ismail
Hesham Ismail on 14 Jul 2015
Thanks, I test it out work nicely

Sign in to comment.

More Answers (0)


Find more on Programming Utilities in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by