Is there a way to make try-catch statements in mex files?
Show older comments
I know that there is no built-in way to do try-catch statements in C, but has Matlab facilitated any type of try-catch functionality for mex files? I tried to use Longjmp and Setjmp in the way described in http://www.di.unipi.it/~nids/docs/longjump_try_trow_catch.html, but I was not successful. Has anyone else figured out a way?
Answers (1)
Jan
on 13 Jun 2013
0 votes
What about using try-catch by writing the code in C++?
4 Comments
Robert
on 13 Jun 2013
Jan
on 19 Jun 2013
Edited: Walter Roberson
on 19 Jun 2013
Fortunately you can put all your C-code into a C++ file, add only some tiny header lines, and use the TRY-CATCH method of C++.
Robert
on 19 Jun 2013
Walter Roberson
on 19 Jun 2013
Link repaired.
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!