Transfer M-file into C code

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.

回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 6 月 1 日

0 投票

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 件のコメント

Fangjun Jiang
Fangjun Jiang 2011 年 6 月 1 日
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
Walter Roberson 2011 年 6 月 1 日
You people change the names on me at least once per decade -- how do you expect me to keep up?! ;-)
Arnaud Miege
Arnaud Miege 2011 年 6 月 2 日
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.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

質問済み:

Di
2011 年 6 月 1 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by