Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB engine versus libraries created by MATLAB Compiler?

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++?

like image 664
Tim Avatar asked Nov 06 '22 19:11

Tim


1 Answers

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.

like image 51
Mark Ruzon Avatar answered Nov 14 '22 22:11

Mark Ruzon