且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有没有办法在mex文件中进行try-catch语句?

更新时间:2022-10-30 18:37:21

你可以在C ++中编写MEX文件,并使用 C ++异常处理


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?

You can write your MEX-files in C++ and use the C++ exception handling.