I have .m file and I really need to convert it to c language. is there any compiler available to do so? I do really appreciate your helps.
Asked
Active
Viewed 3,727 times
2 Answers
3
The only way I know of is using Matlab Coder, which is a quite expensive.
If you do not want to spend that money, I fear your best option is to recode the m-file in C. Does it really have to be C or might C++ be enough. Using the eigen library, Matlab code neatly transforms to C++ without to much trouble.

Thilo
- 8,827
- 2
- 35
- 56
-
MATLAB Compiler does not convert MATLAB code to C code. It archives and encrypts your MATLAB code, and executes it against the redistributable MATLAB Compiler Runtime. A separate and different product MATLAB Coder will convert a subset of the MATLAB language to C code. – Sam Roberts Mar 03 '13 at 03:18
-
@Sam: Thank you. You're of course correct. It's not the first time I mixed those two up. Corrected the answer. – Thilo Mar 03 '13 at 07:44
1
There is the Simulink Coder, from Mathworks, but you must purchase it. You can get a trial version for free, though.
See this similar SO question for more details.

Community
- 1
- 1

Marco Scannadinari
- 1,774
- 2
- 15
- 24
-
Simulink Coder converts Simulink models to C code. To convert a subset of the MATLAB language to C code, MATLAB Coder can be used. – Sam Roberts Mar 03 '13 at 03:20