有没有办法在mex文件中进行try-catch语句? [英] Is there a way to make try-catch statements in mex files?

查看:139
本文介绍了有没有办法在mex文件中进行try-catch语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在C中没有内置的try-catch语句的方法,但MATLAB方便了MEX文件的任何类型的try-catch功能?我试图使用 http://www.di.unipi.it/~nids/docs/longjump_try_trow_catch.html ,但我没有成功。有没有人想出一个方法?

解决方案

你可以在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.

这篇关于有没有办法在mex文件中进行try-catch语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆