When Using engine.h, Getting Matlab to display errors & output in the Command Window

311 Views Asked by At

I am using the matlab engine to call some functions from a c++ program, which works fine. The data is passed, function called and results displayed in figures.

However, if there is a line in the called matlab function, which causes it to error nothing appears so one isn't aware if there has been a issue (i.e for example that a path is incorrectly).

Furthermore, calls to things like disp and fprintf contained in a called function don't show up in the Matlab command window if called via c++...However if exactly the same function is called directly from the very same Matlab command window they do. And finally, a call to save('fileName',var) doesn't result in the variable being saved, again if the function is called directly it does.

What do I need to set in order for this output to show up in the command window as various matlab functions are called from my c++ program?

1

There are 1 best solutions below

0
On

To check for errors, use

lasterror('reset') before the calculations in Matlab and check for errors using lasterror after the calculations.

I don't know about the disp and fprintf functions