Clear Filters
Clear Filters

HowTo 'IFError' and skip

28 views (last 30 days)
Scragmore on 2 Dec 2011
How do identify an error in order that I can skip and run alternative script.
I want to
if fprintf('\t%s\n',TPin{1,2}{:}) iserror("??? Cell contents reference from a non-cell array object.")
do A;
do B;
90% of the time no error will occur, so would I be better writing;
do fprintf('\t%s\n',TPin{1,2}{:});
iserror goto do alternative;
In any case how do I pick up the error and perform a switch in task.

Accepted Answer

the cyclist
the cyclist on 2 Dec 2011
You want to use a "try ... catch" construct:
>> doc try
Scragmore on 2 Dec 2011
Thanks both of you, just what the doctor ordered.

Sign in to comment.

More Answers (0)



Community Treasure Hunt

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

Start Hunting!