compiling matlab code to dll to run on c++ aplication
Mostra commenti meno recenti
hi there,
i have a signal process algorithm written in matlab that runs on a c++ aplication as a compiled exe by matlab compiler.
in order to increase performance i would like to convert the matlab algorithm to C++ language, so that it could run natively on a C++ application, without the need of matlab runtime compiler (MCR).
2 questions: is this possible? how's the performance of matlab compiled dll compared to matlab compiled standalone exe? and to native c++?
i´m avoiding re-writing the algorithm in c++ as it would be quiet a time-consuming task.
thanks!
Risposte (1)
Kaustubha Govind
il 30 Apr 2012
0 voti
You can generate standalone C code from your MATLAB functions using MATLAB Coder - the generated code does not rely on the MCR and performance should be comparable to native code.
AFAIK, MATLAB Compiler shared libraries and standalones should have similar performance, and should be equivalent to running the code in MATLAB (including MATLAB startup and exit time).
However, note that some math operations are highly optimized in MATLAB (use of BLAS routines, multithreading, etc.), so it is possible that the MATLAB Compiler produced binaries are faster than the native code generated using MATLAB Coder. I would recommend getting a demo license for MATLAB Coder to see if you get better performance for your code.
Also, note that to use MATLAB Coder, you are restricted to a subset of the MATLAB language/functions that are supported for code-generation. If you are using functions outside this subset, then MATLAB Compiler is your only alternative to re-writing the algorithm by hand.
1 Commento
Hadi Salimi
il 9 Ott 2020
Categorie
Scopri di più su C Shared Library Integration in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!