Programming Considerations for Code Generation
Generating code from MATLAB for desktop and embedded systems enables you to perform your software design, implementation, testing, and deployment within the MATLAB environment. Due to differences in typing, array sizing, memory and other aspects of MATLAB and C/C++ languages, follow certain guidelines while designing your code in MATLAB for which you intend to generate C/C++ code. There are certain MATLAB language features that code generation does not support. Certain code generation optimizations can cause the generated code to behave differently than the source code. The code generation report and the MATLAB Coder™ app display the potential differences between generated code and MATLAB code.
Decide whether to generate code for your application.
Code generation from MATLAB code requires the MATLAB Coder product and a C/C++ compiler.
When writing MATLAB for code generation, consider design constraints.
Generated C/C++ code can behave differently than original MATLAB source code.
The code generator identifies potential behavior differences between the generated code and the original MATLAB code.
Review potential difference messages.
Use the MATLAB language features and functions that code generation supports.