Other Languages - How to convert matlab code to C language

Asked By Ajain A K P on 22-Nov-11 05:23 AM

I have a project written in Matlab contains multiple matlab functions (written in structured oriented way).
I want to convert those files to C, is there any tool or online websites avilable to achive this.
I tried with google search but I couldn't find any right one. Somebody please help me.

Thanks in advance

Suchit shah replied to Ajain A K P on 22-Nov-11 05:55 AM

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.

 there are a few alternatives:

  1. Matlab Compiler will let you create a shared library (callable from C code) from your .m code.
  2. 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).
Ajain A K P replied to Suchit shah on 22-Nov-11 07:08 AM
Dear Suchit shah,

Thanks a lot for your useful solution. Octave is interesting, I am trying with that tool. Hope I can contact you for further help.
Suchit shah replied to Ajain A K P on 22-Nov-11 07:49 AM
No Problem You Are Most welcome at any time