Transfer M-file into C code
Show older comments
Hi, I want to transfer some function (M file) to C code to enhance my speed. I wonder how to do this and how to call the transferred function. Thank you very much.
Answers (1)
Walter Roberson
on 1 Jun 2011
0 votes
If you want to rewrite the code by hand, you can use mex files. You can do this even with just the basic MATLAB.
If you want to generate the code, then you need MATLAB Coder (current name; MATLAB Compiler in previous versions.) That is an extra-cost product.
3 Comments
Fangjun Jiang
on 1 Jun 2011
Walter,MATLAB Coder is the right tool to transfer M-file into C code. However, it is not the new name for MATLAB Compiler. You probably meant RTW (Real Time Workshop). Now it is re-named Simulink Coder. MATLAB Compiler is to compile M-file into executable.
Walter Roberson
on 1 Jun 2011
You people change the names on me at least once per decade -- how do you expect me to keep up?! ;-)
Arnaud Miege
on 2 Jun 2011
Fangjun's right. Just to clarify:
Pre-R2011a, you could generate C code from MATLAB using Embedded MATLAB. This required you to have Real-Time Workshop, which required Simulink, even if you were not using it.
In R2011a, MATLAB was introduced (a new product) and Real-Time Workshop was merged with Stateflow Coder and renamed to Simulink Coder. This means that for generating C code from MATLAB, you now only need MATLAB Coder and nothing else. MATLAB Coder is a pre-requisite for Simulink Coder.
Categories
Find more on MATLAB Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!