convert matlab code to c code
is there s a way to convert simulink 开发者_运维百科blocks or a matlab ".m" code to C code automatically ?
I'm not aware of any direct translation tool, but there are a few alternatives:
- Matlab Compiler will let you create a shared library (callable from C code) from your .m code.
- GNU Octave is an open source interpreter that has many of the same functions as Matlab. It is open source, and written in C. You might feasibly build a C library based on on this, although it would be a lot more heavy-weight than option (1).
To convert Simulink models or MATLAB m-code to C you need Real-Time Workshop. It supports only subset of MATLAB language and oriented for embedded systems.
Look also at other MatWorks products for code generation and application deployment: http://www.mathworks.com/products
With MATLAB Compiler you will not get a C code, but a binary code, executable or library (dll), which will run on machines without MATLAB installed, but with MATLAB Compiler Runtime (MCR) library. It quite large in size, and platform specific and I believe it has to match the MATLAB version of compiled code.
For the new coming release 2011a The MathWorks developed new code generation products: MATLAB Coder, Simulink Coder and Embedded Coder.
精彩评论