compiling matlab code to dll to run on c++ aplication

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!

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 4월 30일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

질문:

Rui
2012년 4월 27일

댓글:

2020년 10월 9일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by