MATLAB: How to generate c/c++ code

matlab coder

Using Matlab R2014a and Matlab coder, I'm trying to generate c or c++ code automatically from Matlab-code. In Coder, I've selected as output type: "C/C++ Dynamic Library", and enabled the option "generate code only". Building does not succeed, resulting in the message "Project … requires an Embedded Coder license". Do I really need to also buy the toolbox "Embedded Coder"?
Above error message also appears if you try to generate code for the standard Sobel-example"
coderdemo_setup('coderdemo_edge_detection');
codegen -config coder.config('lib') sobel

Best Answer

    • For Code Generation from MATLAB Code, you would need MATLAB Coder and Embedded Coder.
    • For Code Generation using SIMULINK Models, you would need MATLAB Coder, SIMULINK Coder and Embedded Coder.For information on how you could automatically generate C/C++ code, refer to the following links Matlab Coder Conversion to C