| Contents | Index |
Code generation from MATLAB is a restricted subset of the MATLAB language that provides optimizations for:
Generating efficient, production-quality C/C++ code and MEX files for deployment in desktop and embedded applications. For embedded targets, the subset restricts MATLAB semantics to meet the memory and data type requirements of the target environments.
For detailed information about code generation from MATLAB, refer to the Code Generation from MATLAB and MATLAB Coder documentation. Depending on which feature you wish to use, there are additional required products. For a comprehensive list, see Which Code Generation Feature to Use.
Code generation from MATLAB supports Signal Processing Toolbox functions listed in the table. You must have the DSP System Toolbox software installed to use this feature. To generate C code, you must have the MATLAB Coder™ software. If you have the Fixed-Point Toolbox, you can use fiaccel to generate MEX code for fixed-point applications.
To follow the examples in this documentation:
To generate C/C++ code and MEX files with codegen, install the MATLAB Coder software, the Signal Processing Toolbox, the DSP System Toolbox, and a C compiler. For the Windows® platform, MATLAB supplies a default C compiler. Run mex -setup at the MATLAB command prompt to set up the C compiler.
Change to a folder where you have write permission.
Note Many Signal Processing Toolbox functions require constant inputs in generated code. To specify a constant input for codegen, use coder.Constant. For more information, see the MATLAB Coder documentation. |
| Function | Remarks/Limitations |
|---|---|
Window length must be a constant. Expressions or variables are allowed if their values do not change. | |
Window length must be a constant. Expressions or variables are allowed if their values do not change. | |
| besselap | Filter order must be a constant. Expressions or variables are allowed if their values do not change. |
— | |
Window length must be a constant. Expressions or variables are allowed if their values do not change. | |
Window length must be a constant. Expressions or variables are allowed if their values do not change. | |
Window length must be a constant. Expressions or variables are allowed if their values do not change. | |
Filter order must be a constant. Expressions or variables are allowed if their values do not change. | |
Filter coefficients must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All Inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
Length of transform dimension must be a power of two. If specified, the pad or truncation value must be constant. Expressions or variables are allowed if their values do not change. | |
— | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
Inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
Filter coefficients must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constants. Expressions or variables are allowed if their values do not change. | |
freqz with no output arguments produces a plot only when the function call terminates in a semicolon. See freqz With No Output Arguments. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
Length of transform dimension must be a power of two. If specified, the pad or truncation value must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
— | |
If specified, the order of recursion must be a constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
The upsampling and downsampling factors must be specified as constants. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
— | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
All inputs must be constant. Expressions or variables are allowed if their values do not change. | |
| |
Either declare input n as constant, or use the assert function in the calling function to set upper bounds for n. For example, assert(n<10) | |
— | |
If specified, the order of recursion must be a constant. Expressions or variables are allowed if their values do not change. |
![]() | Code Generation from MATLAB Support in Signal Processing Toolbox | Specifying Inputs in Code Generation from MATLAB | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |