Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting Matlab to C++

I need to convert some MATLAB code to C++. I am using Visual Studio 2010 and have MATLAB compiler installed. I am wondering how do I go about doing this.

Also when I publish my project will the end user have to install anything by MATLAB? (this cannot be the case)

like image 587
ddd Avatar asked Oct 11 '11 19:10

ddd


2 Answers

You can compile Matlab scripts into standalone executables, but I'm not familiar with a Matlab tool to convert Matlab code to Visual C++ code. You can convert Matlab code to C or C++ using Simulink Coder (formerly Real-Time Workshop), which is available from Mathworks as a separate product.

To run the standalone executable, the user will have to install the Matlab Compiler Runtime. From the Matlab Compiler web page:

Executables and libraries created with the MATLAB Compiler product use a runtime engine called the MATLAB Compiler Runtime (MCR). The MCR is provided with MATLAB Compiler for distribution with your application and can be deployed royalty-free.

like image 119
eykanal Avatar answered Oct 22 '22 23:10

eykanal


You will not get rid of the Matlab runtimes. I often had problems using Matlab Compiler. It basically is like a wrapper around the Matlab runtime, generates clumsy code and did introduce many problems for deployment. C alternatives ... ? I could not find any. So I recently switched to ilnumerics, which is like Matlab in C# - only much faster and no translation necessary. it works out great so far because we use ASP.NET anyway and hence save jumping between languages and can directly use the 3d plots of ilnumerics.

like image 2
Paul Wendler Avatar answered Oct 22 '22 23:10

Paul Wendler