To call MATLAB code in C or C++, how do you choose between using the MATLAB engine and using the MATLAB Compiler mcc to create C or C++ shared libraries from your MATLAB code? What are their pros and cons? For the second method, see http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/f2-9676.html
Are there other ways to call MATLAB from C or C++?
If the computation is linear and long, I would use mcc to compile the code. It is as if MATLAB was simply another library with numerical routines in it to be linked into your program.
If I wanted to provide interaction with MATLAB in my program, where the user could specify any of a large number of statements that would be impossible or merely tedious to code individually, then I would use the MATLAB engine. It is as if I wanted to run MATLAB without the Mathworks' UI.
I have never bothered with opening the MATLAB engine outside of a test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With