error output from python matlab engine
16 次查看(过去 30 天)
显示 更早的评论
I'd like to get better debug info than the 'matlab function cannot be evaluated' that I currently see from a complex matlab function being run from python using the python matlab engine. Is there some way to pipe extra matlab debug output to a file and/or get more info ?
2 个评论
Stephen23
2016-1-13
编辑:Stephen23
2016-1-13
The documentation
states that you should get the whole MATLAB error message from the Python Engine: "When a MATLAB® function raises an error, the MATLAB Engine for Python® stops the function and catches the exception raised by MATLAB. The engine copies the error message to a new Python exception. The engine raises the Python exception."
That page gives several examples of this.
What other information would you like?
回答(1 个)
Robert Snoeberger
2016-1-15
You could get the last uncaught exception [1] and then call getReport [2] to get the error message for that exception.
Example
>>> import matlab.engine
>>> eng = matlab.engine.start_matlab()
>>>
>>> # Do something that throws an exception...
>>>
>>> eng.eval('exception = MException.last;', nargout=0)
>>> eng.eval('getReport(exception)')
References
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call MATLAB from Python 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!