# Documentation

## Functions and Objects Supported for C/C++ Code Generation — Category List

You can generate efficient C/C++ code for a subset of MATLAB® built-in functions and toolbox functions, classes, and System objects that you call from MATLAB code. These functions, classes, and System objects are listed by MATLAB category or toolbox category in the following tables.

For an alphabetical list of supported functions, classes, and System objects, see Functions and Objects Supported for C/C++ Code Generation — Alphabetical List.

 Note:   For more information on code generation for fixed-point algorithms, refer to Code Acceleration and Code Generation from MATLAB.

### Aerospace Toolbox

C and C++ code generation for the following Aerospace Toolbox quaternion functions requires the Aerospace Blockset™ software.

### Arithmetic Operations in MATLAB

See Array vs. Matrix Operations for detailed descriptions of the following operator equivalent functions.

Function

Remarks and Limitations

`ctranspose`

`idivide`

• For efficient generated code, MATLAB rules for divide by zero are supported only for the `'round'` option.

`isa`

`ldivide`

`minus`

`mldivide`

`mpower`

If `A` is a 2-by-2 or larger matrix and `B` is `Inf` or `-Inf`, `mpower(A,B)` returns a matrix of NaNs.

`mrdivide`

`mtimes`

• Multiplication of pure imaginary numbers by non-finite numbers might not match MATLAB. The code generator does not specialize multiplication by pure imaginary numbers—it does not eliminate calculations with the zero real part. For example, ```(Inf + 1i)*1i = (Inf*0 – 1*1) + (Inf*1 + 1*0)i = NaN + Infi```.

• Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`plus`

`power`

• Generates an error during simulation. When both `X` and `Y` are real, but `power(X,Y)` is complex, returns `NaN` in the generated code. To get the complex result, make the input value `X` complex by passing in `complex(X)`. For example, `power(complex(X),Y)`.

• Generates an error during simulation. When both `X` and `Y` are real, but `X .^ Y` is complex, returns `NaN` in generated code. To get the complex result, make the input value `X` complex by using `complex(X)`. For example, `complex(X).^Y`.

`rdivide`

`times`

Multiplication of pure imaginary numbers by non-finite numbers might not match MATLAB. The code generator does not specialize multiplication by pure imaginary numbers—it does not eliminate calculations with the zero real part. For example, ```(Inf + 1i)*1i = (Inf*0 – 1*1) + (Inf*1 + 1*0)i = NaN + Infi```.

`transpose`

`uminus`

`uplus`

### Audio System Toolbox

C and C++ code generation for the following functions and System objects requires the Audio System Toolbox™ software.

NameRemarks and Limitations
Audio I/O and Waveform Generation

`audioDeviceReader`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`audioDeviceWriter`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`wavetableSynthesizer`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`audioOscillator`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

Audio Processing Algorithm Design

`designVarSlopeFilter`

Supports MATLAB Function block: Yes

`designParamEQ`

Supports MATLAB Function block: Yes

`designShelvingEQ`

Supports MATLAB Function block: Yes

`integratedLoudness`

Supports MATLAB Function block: Yes

`crossoverFilter`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`compressor`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`expander`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`noiseGate`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`limiter`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`multibandParametricEQ`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`octaveFilter`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`weightingFilter`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

`loudnessMeter`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: No

Dynamic Memory Allocation must not be turned off.

`reverberator`

System Objects in MATLAB Code Generation

Supports MATLAB Function block: Yes

Audio Plugins

`audioPluginInterface`

Supports MATLAB Function block: Yes

`audioPluginParameter`

Supports MATLAB Function block: Yes

`audioPlugin`

Supports MATLAB Function block: Yes

`audioPluginSource`

Supports MATLAB Function block: Yes

### Bit-Wise Operations MATLAB

Function

Remarks and Limitations

`flintmax`

`swapbytes`

Inheritance of the class of the input to `swapbytes` in a MATLAB Function block is supported only when the class of the input is `double`. For non-double inputs, the input port data types must be specified, not inherited.

### Casting in MATLAB

Function

Remarks and Limitations

`cast`

`char`

Does not support cell arrays.

`class`

`double`

`logical`

`single`

`typecast`

• Value of data type argument must be lowercase.

• When you use `typecast` with inheritance of input port data types in MATLAB Function blocks, you can receive a size error. To avoid this error, specify the block input port data types explicitly.

• Integer input or result classes must map directly to a C type on the target hardware.

• The input must be a variable-length vector or a fixed-size vector. See

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

• The output vector always has the same orientation as the input vector.

### Character Functions in MATLAB

Function

Remarks and Limitations

`bin2dec`

• Does not support cell arrays.

• Does not match MATLAB when the input is empty.

`blanks`

`char`

Does not support cell arrays.

`deblank`

• Supports only inputs from the `char` class. Does not support cell arrays.

• Input values must be in the range 0-127.

`dec2bin`

• If input `d` is `double`, `d` must be less than `2^52`.

• If input `d` is `single`, `d` must be less than `2^23`.

• Unless you specify input `n` to be constant and `n` is large enough that the output has a fixed number of columns regardless of the input values, this function requires variable-sizing support. Without variable-sizing support, `n` must be at least `52` for `double`, `23` for `single`, `16` for `char`, `32` for `int32`, `16` for `int16`, and so on.

`dec2hex`

• If input `d` is `double`, `d` must be less than `2^52`.

• If input `d` is `single`, `d` must be less than `2^23`.

• Unless you specify input `n` to be constant, and `n` is large enough that the output has a fixed number of columns regardless of the input values, this function requires variable-sizing support. Without variable-sizing support, `n` must be at least `13` for `double`, `6` for `single`, `4` for `char`, `8` for `int32`, `4` for `int16`, and so on.

`hex2dec`

Does not support cell arrays.

`hex2num`

• Does not support cell arrays.

• For `n = hex2num(S)`, ```size(S,2) <= length(num2hex(0))```

`iscellstr`

`ischar`

`isletter`

• Input values from the `char` class must be in the range 0-127.

`isspace`

• Input values from the `char` class must be in the range 0–127.

`isstrprop`

• Supports only inputs from `char` and `integer` classes.

• Input values must be in the range 0-127.

`lower`

• Supports only `char` inputs. Does not support cell arrays.

• Input values must be in the range 0-127.

`num2hex`

`str2double`

• Does not support cell arrays.

• Always returns a complex result.

`strcmp`

• Does not support enumeration inputs.

• When one input is a cell array and the other input is a character array, the character array must be a compile-time row vector.

• When both inputs are empty character arrays that have different sizes, returns true.

`strcmpi`
• Does not support enumeration inputs.

• Input values from the `char` class must be in the range 0-127.

• When one input is a cell array and the other input is a character array, the character array must be a compile-time row vector.

• When both inputs are empty character arrays that have different sizes, returns true.

`strfind`
• Does not support cell arrays.

• Inputs must be character row vectors.

• Returns an empty output as a 1-by-0 character array.

`strjoin`

Returns an empty output as a 1-by-0 character array.

`strjust`
• Does not support a cell array of character vectors for the first argument.

• Returns an empty output as a 1-by-0 character array.

`strncmp`

• Does not support enumeration inputs.

• When one input is a cell array and the other input is a character array, the character array must be a compile-time row vector.

`strncmpi`

• Does not support enumeration inputs.

• Input values from the `char` class must be in the range 0-127.

• When one input is a cell array and the other input is a character array, the character array must be a compile-time row vector.

`strrep`

• Does not support cell arrays.

• Inputs must be character row vectors.

• Returns an empty output as a 1-by-0 character array.

`strtok`

• Does not support a cell array for the first argument.

• Returns an empty output as a 1-by-0 character array.

`strtrim`

• Supports only inputs from the `char` class. Does not support cell arrays.

• Input values must be in the range 0-127.

• Returns an empty output as a 1-by-0 character array.

`upper`

• Supports only inputs from the `char` class. Does not support cell arrays.

• Input values must be in the range 0-127.

### Complex Numbers in MATLAB

Function

Remarks and Limitations

`complex`

`conj`

`cplxpair`

`imag`

`isnumeric`

`isreal`

`isscalar`

`real`

`unwrap`

• Row vector input is only supported when the first two inputs are vectors and nonscalar

• Performs arithmetic in the output class. Hence, results might not match MATLAB due to different rounding errors

### Computer Vision System Toolbox

C and C++ code generation for the following functions and System objects requires the Computer Vision System Toolbox™ software.

NameRemarks and Limitations
Feature Detection, Extraction, and Matching
`BRISKPoints`Supports MATLAB Function block: No
To index locations with this object, use the syntax: `points.Location(idx,:)`, for `points` object. See visionRecovertformCodeGeneration_kernel.m, which is used in the Introduction to Code Generation with Feature Matching and Registration example.
`cornerPoints`Supports MATLAB Function block: No
To index locations with this object, use the syntax: `points.Location(idx,:)`, for `points` object. See visionRecovertformCodeGeneration_kernel.m, which is used in the Introduction to Code Generation with Feature Matching and Registration example.
`detectBRISKFeatures`Supports MATLAB Function block: No
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries.
Portable C Code Generation for Functions That Use OpenCV Library
`detectFASTFeatures`Supports MATLAB Function block: No
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries.
Portable C Code Generation for Functions That Use OpenCV Library
`detectHarrisFeatures`Compile-time constant input: `'FilterSize'`
Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
`detectMinEigenFeatures`Compile-time constant input: `'FilterSize'`
Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
`detectMSERFeatures`Supports MATLAB Function block: No
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries
Portable C Code Generation for Functions That Use OpenCV Library
For code generation, the function outputs `regions.PixelList` as an array. The region sizes are defined in `regions.Lengths`.
`detectSURFFeatures`Supports MATLAB Function block: No
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries.
Portable C Code Generation for Functions That Use OpenCV Library
`extractFeatures`Compile-time constant input restrictions: `'Method'`
Supports MATLAB Function block: Yes for `Block` method only.
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries for `BRISK`, `FREAK`, and `SURF` Methods.
Portable C Code Generation for Functions That Use OpenCV Library
`extractHOGFeatures`Supports MATLAB Function block: No
`extractLBPFeatures`Generates platform-dependent library: No
Supports MATLAB Function block: Yes
`matchFeatures`Generates platform-dependent library: Yes for MATLAB host only when using the `Exhaustive` method.
Generates portable C code for non-host target only when using the `Exhaustive` method.
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries when not using the `Exhaustive` method.
Portable C Code Generation for Functions That Use OpenCV Library
Compile-time constant input: `'Method‘` and `'Metric'`.
Supports MATLAB Function block: No
`MSERRegions`Supports MATLAB Function block: Yes
For code generation, you must specify both the `pixellist` cell array and the `length` of each array, as the second input. The object outputs, `regions.PixelList` as an array. The region sizes are defined in `regions.Lengths`.
Generated code for this function uses a precompiled platform-specific shared library.
`SURFPoints`Supports MATLAB Function block: No
To index locations with this object, use the syntax: `points.Location(idx,:)`, for `points` object. See visionRecovertformCodeGeneration_kernel.m, which is used in the Introduction to Code Generation with Feature Matching and Registration example.
Image Registration and Geometric Transformations
`estimateGeometricTransform`Supports MATLAB Function block: No
`vision.GeometricShearer`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
Object Detection and Recognition
`ocr`Compile-time constant input: `'TextLayout'`, `'Language'`, and `'CharacterSet'`.
Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
`ocrText`Supports MATLAB Function block: No
`vision.PeopleDetector`Supports MATLAB Function block: No
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries.
Portable C Code Generation for Functions That Use OpenCV Library
System Objects in MATLAB Code Generation
`vision.CascadeObjectDetector`Supports MATLAB Function block: No
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries
Portable C Code Generation for Functions That Use OpenCV Library
System Objects in MATLAB Code Generation
Tracking and Motion Estimation
`assignDetectionsToTracks`Supports MATLAB Function block: Yes
`opticalFlowFarneback`Supports MATLAB Function block: No
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries.
Portable C Code Generation for Functions That Use OpenCV Library
`opticalFlowHS`Supports MATLAB Function block: No
`opticalFlowLKDoG`Supports MATLAB Function block: No
`opticalFlowLK`Supports MATLAB Function block: No
`vision.ForegroundDetector`Supports MATLAB Function block: No
For MATLAB host target: Generates platform-dependent library
For nonMATLAB host target: Generates portable C code
System Objects in MATLAB Code Generation
`vision.HistogramBasedTracker`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.KalmanFilter`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.PointTracker`Supports MATLAB Function block: No
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries.
Portable C Code Generation for Functions That Use OpenCV Library
System Objects in MATLAB Code Generation
`vision.TemplateMatcher`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
Camera Calibration and Stereo Vision
`bboxOverlapRatio`Supports MATLAB Function block: No
`bbox2points`

Supports MATLAB® Function block: Yes

`disparity`Compile-time constant input restriction: `'Method'`.
Supports MATLAB Function block: No
Generates portable C code using a C++ compiler that links to OpenCV (Version 2.4.9) libraries.
Portable C Code Generation for Functions That Use OpenCV Library
`cameraPoseToExtrinsics`Supports MATLAB Function block: Yes
`cameraMatrix`Supports MATLAB Function block: No
`cameraPose`Supports MATLAB Function block: No
`cameraParameters`Supports MATLAB Function block: No
Use the `toStruct` method to pass a `cameraParameters` object into generated code. See the Code Generation for Depth Estimation From Stereo Video example.
`detectCheckerboardPoints`Supports MATLAB Function block: No
Code generation will not support specifying images as file names or cell arrays of file names. It supports only checkerboard detection in a single image or stereo pair of images. For example, these syntaxes are supported:
• `detectCheckerboardPoints(I1)`

• `detectCheckerobarPoints(I1,I2)`

`I1` and `I2` are single grayscale or RGB images.
`epipolarline`Supports MATLAB Function block: Yes
`estimateEssentialMatrix`Supports MATLAB Function block: No
`estimateFundamentalMatrix`Compile-time constant input restriction: `'Method'`, `'OutputClass'`, `'DistanceType'`, and `'ReportRuntimeError'`.
Supports MATLAB Function block: Yes
`estimateUncalibratedRectification`Supports MATLAB Function block: Yes
`estimateWorldCameraPose`Supports MATLAB Function block: No
`extrinsics`Supports MATLAB Function block: No
`extrinsicsToCameraPose`Supports MATLAB Function block: Yes
`generateCheckerboardPoints`Supports MATLAB Function block: No
`isEpipoleInImage`Supports MATLAB Function block: Yes
`lineToBorderPoints`Supports MATLAB Function block: Yes
`reconstructScene`Supports MATLAB Function block: No
`rectifyStereoImages`Compile-time constant input restriction: `'interp'` and `'OutputView'`
Supports MATLAB Function block: No
`relativeCameraPose`Supports MATLAB Function block: No
`rotationMatrixToVector`Supports MATLAB Function block: Yes
`rotationVectorToMatrix`Supports MATLAB Function block: Yes
`selectStrongestBbox`Supports MATLAB Function block: No
`stereoAnaglyph`Supports MATLAB Function block: Yes
`stereoParameters`Supports MATLAB Function block: No
Use the `toStruct` method to pass a `stereoParameters` object into generated code. See the Code Generation for Depth Estimation From Stereo Video example.
`triangulate`Supports MATLAB Function block: No
`undistortImage`Compile-time constant input restriction: `'interp'` and `'OutputView'`
Supports MATLAB Function block: No
Statistics
`vision.Autocorrelator`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.BlobAnalysis`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.Crosscorrelator`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.LocalMaximaFinder`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.Maximum`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.Mean`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.Median`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.Minimum`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.StandardDeviation`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.Variance`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
Filters, Transforms, and Enhancements
`integralImage`Supports MATLAB Function block: Yes
`vision.Convolver`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.DCT`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.Deinterlacer`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.FFT`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.HoughLines`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.IDCT`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.IFFT`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.MedianFilter`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.Pyramid`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.DeployableVideoPlayer`Supports MATLAB Function block: Yes
Generated code for this function uses a precompiled platform-specific shared library.
System Objects in MATLAB Code Generation
`vision.VideoFileReader`Supports MATLAB Function block: Yes
Generated code for this function uses a precompiled platform-specific shared library.
System Objects in MATLAB Code Generation

Does not generate code for reading compressed images on the Mac.

`vision.VideoFileWriter`Supports MATLAB Function block: Yes
Generated code for this function uses a precompiled platform-specific shared library.
System Objects in MATLAB Code Generation
Color Space Formatting and Conversions
`vision.ChromaResampler`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.DemosaicInterpolator`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.GammaCorrector`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
Graphics
`insertMarker`Compile-time constant input: `'Shape'` and `'Color'`
Supports MATLAB Function block: Yes
`insertShape`Compile-time constant input: `'Color'` and `'SmoothEdges'`
Supports MATLAB Function block: Yes
`insertObjectAnnotation`Supports MATLAB Function block: Yes
Limitation: Input image must be bounded, see Specify Variable-Size Data Without Dynamic Memory Allocation
System Objects in MATLAB Code Generation
`insertText`Compile-time constant input: `Font`, `FontSize`
Supports non-ASCII characters: No
Supports MATLAB Function block: Yes
`vision.AlphaBlender`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.MarkerInserter`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.ShapeInserter`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation

### Control Flow in MATLAB

Function

Remarks and Limitations

`break`

`continue`

`end`

`for`

`if, elseif, else`

`parfor`

Treated as a `for`-loop when used with `fiaccel`.

`return`

`switch, case, otherwise`

• If all case expressions are scalar integer values, generates a C `switch` statement. At run time, if the switch value is not an integer, generates an error.

• When the case expressions contain noninteger or nonscalar values, the code generator produces C `if` statements in place of a C `switch` statement.

`while`

### Control System Toolbox

C and C++ code generation for the following functions requires the Control System Toolbox™ software.

Name

Remarks and Limitations

`extendedKalmanFilter`

For more information, see Generate Code for Online State Estimation in MATLAB.

Supports MATLAB Function block: No

`unscentedKalmanFilter`

For more information, see Generate Code for Online State Estimation in MATLAB.

Supports MATLAB Function block: No

### Data and File Management in MATLAB

Function

Remarks and Limitations

`computer`

• Information about the computer on which the code generator is running.

• Use only when the code generation target is S-function (Simulation) or MEX-function.

`fclose`

`feof`

`fopen`

• Does not support:

• `machineformat`, `encoding`, or `fileID` inputs

• `message` output

• `fopen('all')`

• Opening a file in text mode. (The file access type cannot be `'rt'`.)

• If you disable extrinsic calls, you cannot return `fileID`s created with `fopen` to MATLAB or extrinsic functions. You can use such `fileID`s only internally.

• When generating C/C++ executables, static libraries, or dynamic libraries, you can open up to 20 files.

• The generated code does not report errors from invalid file identifiers. Write your own file open error handling in your MATLAB code. Test whether `fopen` returns `-1`, which indicates that the file open failed. For example:

```... fid = fopen(filename, 'r'); if fid == -1 % fopen failed else % fopen successful, okay to call fread A = fread(fid); ...```

• The behavior of the generated code for `fread` is compiler-dependent if you:

1. Open a file using `fopen` with a `permission` of `a+`.

2. Read the file using `fread` before calling an I/O function, such as `fseek` or `frewind`, that sets the file position indicator.

`fprintf`

• Does not support:

• `b` and `t` subtypes on `%u`, `%o` `%x`, and `%X` formats.

• `\$` flag for reusing input arguments.

• printing arrays.

• There is no automatic casting. Input arguments must match their format types for predictable results.

• Escaped characters are limited to the decimal range of 0–127.

• A call to `fprintf` with `fileID` equal to `1` or `2` becomes `printf` in the generated C/C++ code in the following cases:

• The `fprintf` call is inside a `parfor` loop.

• Extrinsic calls are disabled.

• When the MATLAB behavior differs from the C compiler behavior, `fprintf` matches the C compiler behavior in the following cases:

• The format specifier has a corresponding C format specifier, for example, ` %e` or `%E`.

• The `fprintf` call is inside a `parfor` loop.

• Extrinsic calls are disabled.

• When you call `fprintf` with the format specifier `%s`, do not put a null character in the middle of the input character vector. Use ```fprintf(fid, '%c', char(0))``` to write a null character.

• When you call `fprintf` with an integer format specifier, the type of the integer argument must be a type that the target hardware can represent as a native C type. For example, if you call `fprintf('%d', int64(n))`, the target hardware must have a native C type that supports a 64-bit integer.

`fread`

• `precision` must be a constant.

• The `source` and `output` that `precision` specifies cannot have values `long`, `ulong`, ```unsigned long```, `bitN`, or `ubitN`.

• You cannot use the `machineformat` input.

• If the `source` or `output` that `precision` specifies is a C type, for example, `int`, the target and production sizes for that type must:

• Match.

• Map directly to a MATLAB type.

• The `source` type that `precision` specifies must map directly to a C type on the target hardware.

• If the `fread` call reads the entire file, all of the data must fit in the largest array available for code generation.

• If `sizeA` is not constant or contains a nonfinite element, then dynamic memory allocation is required.

• Treats a `char` value for `source` or `output` as a signed 8-bit integer. Use values between 0 and 127 only.

• The generated code does not report file read errors. Write your own file read error handling in your MATLAB code. Test that the number of bytes read matches the number of bytes that you requested. For example:

```... N = 100; [vals, numRead] = fread(fid, N, '*double'); if numRead ~= N % fewer elements read than expected end ...```

`frewind`

`fseek`

• When the MATLAB behavior differs from the C compiler behavior, the generated code matches the C compiler behavior. Examples include:

• Seeking past the end of a file.

• Seeking away from the end of a file opened with append access.

• The offset is passed to the C run-time environment as a signed long data type. Therefore, the offset value must fit in the long data type on the target hardware.

`ftell`

When the MATLAB behavior differs from the C compiler behavior, the generated code usually matches the C compiler behavior. For example, if you use `fseek` to seek past the end of a file, the behavior of `ftell` in the generated code matches the C compiler behavior.

`fwrite`

• The precision argument must be a constant.

• Does not support precision types `'long'`, `'ulong'`, `'unsigned long'`, `'bitn'`, and `'ubitn'`.

• Does not support the machine format (order for writing bytes) input argument.

• If the precision is a C type such as `int`, the target and production sizes for that type must:

• Match.

• Map directly to a MATLAB integer type.

• Treats a `char` type as a signed 8-bit integer. Use values from 0 through 127 only.

• When appending to a file and using a skip argument, it must be possible for the C run-time `fseek` to seek beyond the end of the file and initialize unwritten bytes to 0. This behavior matches the behavior of POSIX® and Windows®.

`load`

• Use only when generating MEX or code for Simulink® simulation. To load compile-time constants, use `coder.load`.

• Does not support use of the function without assignment to a structure or array. For example, use `S = load(filename)`, not `load(filename)`.

• The output `S` must be the name of a structure or array without any subscripting. For example, `S(i) = load('myFile.mat')` is not allowed.

• Arguments to `load` must be compile-time constant character vectors.

• If the MAT-file contains unsupported constructs, use `load(filename,variables)` to load only the supported constructs.

• You cannot use `save` in a function intended for code generation. The code generator does not support the `save` function. Furthermore, you cannot use `coder.extrinsic` with `save`. Prior to generating code, you can use `save` to save the workspace data to a MAT-file.

You must use `coder.varsize` to explicitly declare variable-size data loaded using the `load` function.

### Data Types in MATLAB

Function

Remarks and Limitations

`cell`

`deal`

`fieldnames`

Does not support objects. The input must be a structure.

`iscell`

`isenum`

`isfield`

Does not support cell arrays for the second argument.

`isobject`

`isstruct`

`narginchk`

`nargoutchk`

`str2func`

• Character vector must be constant/known at compile time

`struct`

• You cannot create a structure that contains a cell array. For example, you cannot generate code for:

`s = struct('a',{{1 2}})`

• If the `value` argument is a cell array, all elements must have the same type.

`struct2cell`

• For a variable-size structure array, the resulting cell array must be homogeneous. If `s` is a variable-size structure array, the fields must have the same type.

• If `struct2cell` cannot convert `s` to a homogeneous cell array, the output cell array is heterogeneous. A heterogeneous output cell array can have a maximum of 1024 elements.

`structfun`

• Does not support the `ErrorHandler` option.

• The number of outputs must be less than or equal to three.

### Desktop Environment in MATLAB

Function

Remarks and Limitations

`ismac`

• Returns true or false based on the MATLAB version used for code generation.

• Use only when the code generation target is S-function (Simulation) or MEX-function.

`ispc`

• Returns true or false based on the MATLAB version you use for code generation.

• Use only when the code generation target is S-function (Simulation) or MEX-function.

`isunix`

• Returns true or false based on the MATLAB version used for code generation.

• Use only when the code generation target is S-function (Simulation) or MEX-function.

### Discrete Math in MATLAB

Function

Remarks and Limitations

`factor`

• The maximum double precision input is `2^33`.

• The maximum single precision input is `2^25`.

• The input `n` cannot have type `int64` or `uint64`.

`gcd`

`isprime`

• The maximum double precision input is `2^33`.

• The maximum single precision input is `2^25`.

• The input `X` cannot have type `int64` or `uint64`.

`lcm`

`nchoosek`

• When the first input, `x`, is a scalar, `nchoosek` returns a binomial coefficient. In this case, `x` must be a nonnegative integer. It cannot have type `int64` or `uint64`.

• When the first input, `x`, is a vector, `nchoosek` treats it as a set. In this case, `x` can have type `int64` or `uint64`.

• The second input, `k`, cannot have type `int64` or `uint64`.

• Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`primes`

• The maximum double precision input is `2^32`.

• The maximum single precision input is `2^24`.

• The input `n` cannot have type `int64` or `uint64`.

### DSP System Toolbox

C code generation for the following functions and System objects requires the DSP System Toolbox™ license. Many DSP System Toolbox functions require constant inputs for code generation. To specify a constant input for `fiaccel`, use `coder.Constant`. For more information, see Specify Constant Inputs at the Command Line.

NameRemarks and Limitations
Estimation

`dsp.BurgAREstimator`

System Objects in MATLAB Code Generation

`dsp.BurgSpectrumEstimator`

• When the FFT length is not a power of `2`, use the `packNGo` function to package the code generated from this System object™ and all relevant files in a compressed zip file. Using this zip file, you can relocate, unpack, and rebuild your project in another development environment with no MATLAB installed. For an example, see Package Code for Other Development Environments.

• System Objects in MATLAB Code Generation

`dsp.CepstralToLPC`

System Objects in MATLAB Code Generation

`dsp.CrossSpectrumEstimator`

• When the FFT length is not a power of `2`, use the `packNGo` function to package the code generated from this System object and all relevant files in a compressed zip file. Using this zip file, you can relocate, unpack, and rebuild your project in another development environment with no MATLAB installed. For an example, see Package Code for Other Development Environments.

• System Objects in MATLAB Code Generation

`dsp.LevinsonSolver`

System Objects in MATLAB Code Generation

`dsp.LPCToAutocorrelation`

System Objects in MATLAB Code Generation

`dsp.LPCToCepstral`

System Objects in MATLAB Code Generation

`dsp.LPCToLSF`

System Objects in MATLAB Code Generation

`dsp.LPCToLSP`

System Objects in MATLAB Code Generation

`dsp.LPCToRC`

System Objects in MATLAB Code Generation

`dsp.LSFToLPC`

System Objects in MATLAB Code Generation

`dsp.LSPToLPC`

System Objects in MATLAB Code Generation

`dsp.RCToAutocorrelation`

System Objects in MATLAB Code Generation

`dsp.RCToLPC`

System Objects in MATLAB Code Generation

`dsp.SpectrumEstimator`

• When the FFT length is not a power of `2`, use the `packNGo` function to package the code generated from this System object and all relevant files in a compressed zip file. Using this zip file, you can relocate, unpack, and rebuild your project in another development environment with no MATLAB installed. For an example, see Package Code for Other Development Environments.

• System Objects in MATLAB Code Generation

`dsp.TransferFunctionEstimator`

• When the FFT length is not a power of `2`, use the `packNGo` function to package the code generated from this System object and all relevant files in a compressed zip file. Using this zip file, you can relocate, unpack, and rebuild your project in another development environment with no MATLAB installed. For an example, see Package Code for Other Development Environments.

• System Objects in MATLAB Code Generation

Filters

`ca2tf`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`cl2tf`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`dsp.AdaptiveLatticeFilter`

System Objects in MATLAB Code Generation

`dsp.AffineProjectionFilter`

System Objects in MATLAB Code Generation

`dsp.AllpassFilter`

System Objects in MATLAB Code Generation

The System object supports code generation only when the `Structure` property is set to `Minimum multiplier` or `Lattice`.

`dsp.AllpoleFilter`

`dsp.BiquadFilter`

System Objects in MATLAB Code Generation

`dsp.Channelizer`

System Objects in MATLAB Code Generation

`dsp.ChannelSynthesizer`

System Objects in MATLAB Code Generation

`dsp.CICCompensationDecimator`

System Objects in MATLAB Code Generation

`dsp.CICCompensationInterpolator`

System Objects in MATLAB Code Generation

`dsp.CICDecimator`

System Objects in MATLAB Code Generation

`dsp.CICInterpolator`

System Objects in MATLAB Code Generation

`dsp.Differentiator`

System Objects in MATLAB Code Generation

`dsp.FarrowRateConverter`

System Objects in MATLAB Code Generation

`dsp.FastTransversalFilter`

System Objects in MATLAB Code Generation

`dsp.FilterCascade`

• You cannot generate code directly from `dsp.FilterCascade`. You can use the `generateFilteringCode` method to generate a MATLAB function. You can generate C/C++ code from this MATLAB function.

• System Objects in MATLAB Code Generation

`dsp.FilteredXLMSFilter`

System Objects in MATLAB Code Generation

`dsp.FIRDecimator`

System Objects in MATLAB Code Generation

`dsp.FIRFilter`

`dsp.FIRHalfbandDecimator`

System Objects in MATLAB Code Generation

`dsp.FIRHalfbandInterpolator`

System Objects in MATLAB Code Generation

`dsp.FIRInterpolator`

System Objects in MATLAB Code Generation

`dsp.FIRRateConverter`

System Objects in MATLAB Code Generation

`dsp.FrequencyDomainAdaptiveFilter`

• When the sum of `BlockLength` and `Length` is not a power of `2`, use the `packNGo` function to package the code generated from this System object and all relevant files in a compressed zip file. Using this zip file, you can relocate, unpack, and rebuild your project in another development environment with no MATLAB installed. For an example, see Package Code for Other Development Environments.

• System Objects in MATLAB Code Generation

`dsp.HighpassFilter`

System Objects in MATLAB Code Generation

`dsp.IIRFilter`

`dsp.IIRHalfbandDecimator`

System Objects in MATLAB Code Generation

`dsp.IIRHalfbandInterpolator`

System Objects in MATLAB Code Generation

`dsp.KalmanFilter`

System Objects in MATLAB Code Generation

`dsp.LMSFilter`

System Objects in MATLAB Code Generation

`dsp.LowpassFilter`

System Objects in MATLAB Code Generation

`dsp.MedianFilter`

System Objects in MATLAB Code Generation

`dsp.RLSFilter`

System Objects in MATLAB Code Generation

`dsp.SampleRateConverter`

System Objects in MATLAB Code Generation

`dsp.SubbandAnalysisFilter`

System Objects in MATLAB Code Generation

`dsp.SubbandSynthesisFilter`

System Objects in MATLAB Code Generation

`dsp.VariableBandwidthFIRFilter`

System Objects in MATLAB Code Generation

`dsp.VariableBandwidthIIRFilter`

System Objects in MATLAB Code Generation

`firceqrip`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`fireqint`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`firgr`

• All inputs must be constant. Expressions or variables are allowed if their values do not change.

• Does not support syntaxes that have cell array input.

`firhalfband`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`firlpnorm`

• All inputs must be constant. Expressions or variables are allowed if their values do not change.

• Does not support syntaxes that have cell array input.

`firminphase`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`firnyquist`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`firpr2chfb`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`ifir`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`iircomb`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`iirgrpdelay`

• All inputs must be constant. Expressions or variables are allowed if their values do not change.

• Does not support syntaxes that have cell array input.

`iirlpnorm`

• All inputs must be constant. Expressions or variables are allowed if their values do not change.

• Does not support syntaxes that have cell array input.

`iirlpnormc`

• All inputs must be constant. Expressions or variables are allowed if their values do not change.

• Does not support syntaxes that have cell array input.

`iirnotch`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`iirpeak`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`tf2ca`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`tf2cl`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

Filter Design

`designMultirateFIR`

The inputs to the function must be constants

Math Operations

`dsp.ArrayVectorAdder`

System Objects in MATLAB Code Generation

`dsp.ArrayVectorDivider`

System Objects in MATLAB Code Generation

`dsp.ArrayVectorMultiplier`

System Objects in MATLAB Code Generation

`dsp.ArrayVectorSubtractor`

System Objects in MATLAB Code Generation

`dsp.CumulativeProduct `

System Objects in MATLAB Code Generation

`dsp.CumulativeSum`

System Objects in MATLAB Code Generation

`dsp.LDLFactor`

System Objects in MATLAB Code Generation

`dsp.LevinsonSolver`

System Objects in MATLAB Code Generation

`dsp.LowerTriangularSolver`

System Objects in MATLAB Code Generation

`dsp.LUFactor`

System Objects in MATLAB Code Generation

`dsp.Normalizer`

System Objects in MATLAB Code Generation

`dsp.UpperTriangularSolver`

System Objects in MATLAB Code Generation

Quantizers

`dsp.ScalarQuantizerDecoder`

System Objects in MATLAB Code Generation

`dsp.ScalarQuantizerEncoder`

System Objects in MATLAB Code Generation

`dsp.VectorQuantizerDecoder`

System Objects in MATLAB Code Generation

`dsp.VectorQuantizerEncoder`

System Objects in MATLAB Code Generation

Scopes

`dsp.ArrayPlot`

`dsp.SpectrumAnalyzer`

`dsp.TimeScope`

Signal Management

`dsp.Counter`

System Objects in MATLAB Code Generation

`dsp.DelayLine`

System Objects in MATLAB Code Generation

Signal Operations

`dsp.Convolver`

System Objects in MATLAB Code Generation

`dsp.DCBlocker`

System Objects in MATLAB Code Generation

`dsp.Delay`

System Objects in MATLAB Code Generation

`dsp.DigitalDownConverter`

System Objects in MATLAB Code Generation

`dsp.DigitalUpConverter`

System Objects in MATLAB Code Generation

`dsp.Interpolator`

System Objects in MATLAB Code Generation

`dsp.NCO`

System Objects in MATLAB Code Generation

`dsp.PeakFinder`

System Objects in MATLAB Code Generation

`dsp.PhaseExtractor`

System Objects in MATLAB Code Generation

`dsp.PhaseUnwrapper`

System Objects in MATLAB Code Generation

`dsp.VariableFractionalDelay`

System Objects in MATLAB Code Generation

`dsp.VariableIntegerDelay`

System Objects in MATLAB Code Generation

`dsp.Window`

`dsp.ZeroCrossingDetector`

System Objects in MATLAB Code Generation

Sinks

`audioDeviceWriter`

`dsp.AudioFileWriter`

`dsp.BinaryFileWriter`

System Objects in MATLAB Code Generation

`dsp.UDPSender`

Sources

`dsp.AudioFileReader`

`dsp.BinaryFileReader`

System Objects in MATLAB Code Generation

`dsp.SignalSource`

System Objects in MATLAB Code Generation

`dsp.SineWave`

`dsp.UDPReceiver`

Statistics

`dsp.Autocorrelator`

System Objects in MATLAB Code Generation

`dsp.Crosscorrelator`

System Objects in MATLAB Code Generation

`dsp.Histogram`

`dsp.Maximum`

System Objects in MATLAB Code Generation

`dsp.Mean`

System Objects in MATLAB Code Generation

`dsp.Median`

System Objects in MATLAB Code Generation

`dsp.MedianFilter`

System Objects in MATLAB Code Generation

`dsp.Minimum`

System Objects in MATLAB Code Generation

`dsp.MovingAverage`

System Objects in MATLAB Code Generation

`dsp.MovingMaximum`

System Objects in MATLAB Code Generation

`dsp.MovingMinimum`

System Objects in MATLAB Code Generation

`dsp.MovingRMS`

System Objects in MATLAB Code Generation

`dsp.MovingStandardDeviation`

System Objects in MATLAB Code Generation

`dsp.MovingVariance`

System Objects in MATLAB Code Generation

`dsp.PeakToPeak`

System Objects in MATLAB Code Generation

`dsp.PeakToRMS`

System Objects in MATLAB Code Generation

`dsp.RMS`

System Objects in MATLAB Code Generation

`dsp.StandardDeviation`

System Objects in MATLAB Code Generation

`dsp.StateLevels`

System Objects in MATLAB Code Generation

`dsp.Variance`

System Objects in MATLAB Code Generation

Transforms

`dsp.AnalyticSignal`

System Objects in MATLAB Code Generation

`dsp.DCT`

System Objects in MATLAB Code Generation

`dsp.FFT`

• Under the following conditions:

• When `FFTImplementation` is set to `'FFTW'`.

• When `FFTImplementation` is set to `'Auto'`, `FFTLengthSource` is set to `'Property'`, and `FFTLength` is not a power of `2`.

Use the `packNGo` function to package the code generated from this System object and all relevant files in a compressed zip file. Using this zip file, you can relocate, unpack, and rebuild your project in another development environment with no MATLAB installed. For an example, see Package Code for Other Development Environments.

• System Objects in MATLAB Code Generation

`dsp.IDCT`

System Objects in MATLAB Code Generation

`dsp.IFFT`

• Under the following conditions:

• When `FFTImplementation` is set to `'FFTW'`.

• When `FFTImplementation` is set to `'Auto'`, `FFTLengthSource` is set to `'Property'`, and `FFTLength` is not a power of `2`.

Use the `packNGo` function to package the code generated from this System object and all relevant files in a compressed zip file. Using this zip file, you can relocate, unpack, and rebuild your project in another development environment with no MATLAB installed. For an example, see Package Code for Other Development Environments.

• System Objects in MATLAB Code Generation

### Error Handling in MATLAB

Function

Remarks and Limitations

`assert`

• Generates specified error messages at compile time only if all input arguments are constants or depend on constants. Otherwise, generates specified error messages at run time.

• For standalone code generation, excluded from the generated code.

`error`

For standalone code generation, excluded from the generated code.

### Exponents in MATLAB

Function

Remarks and Limitations

`expm`

`expm1`

`factorial`

`log`

• Generates an error during simulation and returns `NaN` in generated code when the input value `x` is real, but the output should be complex. To get the complex result, make the input value complex by passing in `complex(x)`.

`log2`

`log10`

`log1p`

`nextpow2`

`nthroot`

`reallog`

`realpow`

`realsqrt`

`sqrt`

• Generates an error during simulation and returns `NaN` in generated code when the input value `x` is real, but the output should be complex. To get the complex result, make the input value complex by passing in `complex(x)`.

### Filtering and Convolution in MATLAB

Function

Remarks and Limitations

`conv2`

`convn`

`deconv`

`detrend`

• If supplied and not empty, the input argument `bp` must satisfy the following requirements:

• Be real.

• Be sorted in ascending order.

• Restrict elements to integers in the interval ```[1, n-2]```. `n` is the number of elements in a column of input argument `X` , or the number of elements in `X` when `X` is a row vector.

• Contain all unique values.

• Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`filter`

`filter2`

### Fixed-Point Designer

In addition to function-specific limitations listed in the table, the following general limitations apply to the use of Fixed-Point Designer™ functions in generated code, with `fiaccel`:

• `fipref` and `quantizer` objects are not supported.

• Word lengths greater than 128 bits are not supported.

• You cannot change the `fimath` or `numerictype` of a given `fi` variable after that variable has been created.

• The `boolean` value of the `DataTypeMode` and `DataType` properties are not supported.

• For all `SumMode` property settings other than `FullPrecision`, the `CastBeforeSum` property must be set to `true`.

• You can use parallel for (`parfor`) loops in code compiled with `fiaccel`, but those loops are treated like regular `for` loops.

• When you compile code containing `fi` objects with nontrivial slope and bias scaling, you may see different results in generated code than you achieve by running the same code in MATLAB.

FunctionRemarks/Limitations

`abs`

N/A

`accumneg`

N/A

`accumpos`

N/A

`add`

• Code generation in MATLAB does not support the syntax `F.add(a,b)`. You must use the syntax `add(F,a,b)`.

`all`

N/A

`any`

N/A

`atan2`

N/A

`bitand`

Not supported for slope-bias scaled `fi` objects.

`bitandreduce`

N/A

`bitcmp`

N/A

`bitconcat`

N/A

`bitget`

N/A

`bitor`

Not supported for slope-bias scaled `fi` objects.

`bitorreduce`

N/A

`bitreplicate`

N/A

`bitrol`

N/A

`bitror`

N/A

`bitset`

N/A

`bitshift`

N/A

`bitsliceget`

N/A

`bitsll`

Generated code may not handle out of range shifting.

`bitsra`

Generated code may not handle out of range shifting.

`bitsrl`

Generated code may not handle out of range shifting.

`bitxor`

Not supported for slope-bias scaled `fi` objects.

`bitxorreduce`

N/A

`ceil`

N/A

`complex`

N/A

`conj`

N/A

`conv`

• Variable-sized inputs are only supported when the `SumMode` property of the governing `fimath` is set to ```Specify precision``` or `Keep LSB`.

• For variable-sized signals, you may see different results between generated code and MATLAB.

• In the generated code, the output for variable-sized signals is computed using the `SumMode` property of the governing `fimath`.

• In MATLAB, the output for variable-sized signals is computed using the `SumMode` property of the governing `fimath` when both inputs are nonscalar. However, if either input is a scalar, MATLAB computes the output using the `ProductMode` of the governing `fimath`.

`convergent`

N/A

`cordicabs`

Variable-size signals are not supported.

`cordicangle`

Variable-size signals are not supported.

`cordicatan2`

Variable-size signals are not supported.

`cordiccart2pol`

Variable-size signals are not supported.

`cordiccexp`

Variable-size signals are not supported.

`cordiccos`

Variable-size signals are not supported.

`cordicpol2cart`

Variable-size signals are not supported.

`cordicrotate`

Variable-size signals are not supported.

`cordicsin`

Variable-size signals are not supported.

`cordicsincos`

Variable-size signals are not supported.

`cordicsqrt`

Variable-size signals are not supported.

`cos`

N/A

`ctranspose`

N/A

`diag`

If supplied, the index, k, must be a real and scalar integer value that is not a `fi` object.

`divide`

• Any non-`fi` input must be constant; that is, its value must be known at compile time so that it can be cast to a `fi` object.

• Complex and imaginary divisors are not supported.

• Code generation in MATLAB does not support the syntax `T.divide(a,b)`.

`double`

For the automated workflow, do not use explicit double or single casts in your MATLAB algorithm to insulate functions that do not support fixed-point data types. The automated conversion tool does not support these casts. Instead of using casts, supply a replacement function. For more information, see Function Replacements.

`end`

N/A

`eps`

• Supported for scalar fixed-point signals only.

• Supported for scalar, vector, and matrix, `fi` single and `fi` double signals.

`eq`

Not supported for fixed-point signals with different biases.

`fi`

• The default constructor syntax without any input arguments is not supported.

• If the `numerictype` is not fully specified, the input to `fi` must be a constant, a `fi`, a single, or a built-in integer value. If the input is a built-in double value, it must be a constant. This limitation allows `fi` to autoscale its fraction length based on the known data type of the input.

• All properties related to data type must be constant for code generation.

• `numerictype` object information must be available for nonfixed-point Simulink inputs.

`filter`

• Variable-sized inputs are only supported when the `SumMode` property of the governing `fimath` is set to ```Specify precision``` or `Keep LSB`.

`fimath`

• Fixed-point signals coming in to a MATLAB Function block from Simulink are assigned a `fimath` object. You define this object in the MATLAB Function block dialog in the Model Explorer.

• Use to create `fimath` objects in the generated code.

• If the `ProductMode` property of the `fimath` object is set to anything other than `FullPrecision`, the `ProductWordLength` and `ProductFractionLength` properties must be constant.

• If the `SumMode` property of the `fimath` object is set to anything other than `FullPrecision`, the `SumWordLength` and `SumFractionLength` properties must be constant.

`fix`

N/A

`fixed.Quantizer`

N/A

`flip`

The dimensions argument must be a built-in type; it cannot be a `fi` object.

`fliplr`

N/A

`flipud`

N/A

`floor`

N/A

`for`

N/A

`ge`

Not supported for fixed-point signals with different biases.

`get`

The syntax ```structure = get(o)``` is not supported.

`getlsb`

N/A

`getmsb`

N/A

`gt`

Not supported for fixed-point signals with different biases.

`horzcat`

N/A

`imag`

N/A
N/A

`ipermute`

N/A

`iscolumn`

N/A

`isempty`

N/A

`isequal`

N/A

`isfi`

Avoid using the `isfi` function in code that you intend to convert using the automated workflow. The value returned by `isfi` in the fixed-point code might differ from the value returned in the original MATLAB algorithm. The behavior of the fixed-point code might differ from the behavior of the original algorithm.

`isfimath`

N/A

`isfimathlocal`

N/A

`isfinite`

N/A

`isinf`

N/A

`isnan`

N/A

`isnumeric`

N/A

`isnumerictype`

N/A

`isreal`

N/A

`isrow`

N/A

`isscalar`

N/A

`issigned`

N/A

`isvector`

N/A

`le`

Not supported for fixed-point signals with different biases.

`length`

N/A

`logical`

N/A

`lowerbound`

N/A

`lsb`

• Supported for scalar fixed-point signals only.

• Supported for scalar, vector, and matrix, `fi` single and double signals.

`lt`

Not supported for fixed-point signals with different biases.

`max`

N/A

`mean`

N/A

`median`

N/A

`min`

N/A

`minus`

Any non-`fi` input must be constant; that is, its value must be known at compile time so that it can be cast to a `fi` object.

`mpower`

• When the exponent `k` is a variable and the input is a scalar, the `ProductMode` property of the governing `fimath` must be `SpecifyPrecision`.

• When the exponent `k` is a variable and the input is not scalar, the `SumMode` property of the governing `fimath` must be `SpecifyPrecision`.

• Variable-sized inputs are only supported when the `SumMode` property of the governing `fimath` is set to `SpecifyPrecision` or ```Keep LSB```.

• For variable-sized signals, you may see different results between the generated code and MATLAB.

• In the generated code, the output for variable-sized signals is computed using the `SumMode` property of the governing `fimath`.

• In MATLAB, the output for variable-sized signals is computed using the `SumMode` property of the governing `fimath` when the first input, `a`, is nonscalar. However, when `a` is a scalar, MATLAB computes the output using the `ProductMode` of the governing `fimath`.

`mpy`

• Code generation in MATLAB does not support the syntax `F.mpy(a,b)`. You must use the syntax `mpy(F,a,b)`.

• When you provide complex inputs to the `mpy` function inside of a MATLAB Function block, you must declare the input as complex before running the simulation. To do so, go to the Ports and data manager and set the Complexity parameter for all known complex inputs to `On`.

`mrdivide`

N/A

`mtimes`

• Any non-`fi` input must be constant; that is, its value must be known at compile time so that it can be cast to a `fi` object.

• Variable-sized inputs are only supported when the `SumMode` property of the governing `fimath` is set to `SpecifyPrecision` or `KeepLSB`.

• For variable-sized signals, you may see different results between the generated code and MATLAB.

• In the generated code, the output for variable-sized signals is computed using the `SumMode` property of the governing `fimath`.

• In MATLAB, the output for variable-sized signals is computed using the `SumMode` property of the governing `fimath` when both inputs are nonscalar. However, if either input is a scalar, MATLAB computes the output using the `ProductMode` of the governing `fimath`.

`ndims`

N/A

`ne`

Not supported for fixed-point signals with different biases.

`nearest`

N/A

`numberofelements`

`numberofelements` will be removed in a future release. Use `numel` instead.

`numel`

N/A

`numerictype`

• Fixed-point signals coming in to a MATLAB Function block from Simulink are assigned a `numerictype` object that is populated with the signal's data type and scaling information.

• Returns the data type when the input is a nonfixed-point signal.

• Use to create `numerictype` objects in generated code.

• All `numerictype` object properties related to the data type must be constant.

`permute`

The dimensions argument must be a built-in type; it cannot be a `fi` object.

`plus`

Any non-`fi` inputs must be constant; that is, its value must be known at compile time so that it can be cast to a `fi` object.

`pow2`

N/A

`power`

When the exponent `k` is a variable, the `ProductMode` property of the governing `fimath` must be `SpecifyPrecision`.

`qr`

N/A

`quantize`

N/A

`range`

N/A

`rdivide`

N/A

`real`

N/A

`realmax`

N/A

`realmin`

N/A

`reinterpretcast`

N/A

`removefimath`

N/A

`repmat`

The dimensions argument must be a built-in type; it cannot be a `fi` object.

`rescale`

N/A

`reshape`

N/A

`rot90`

In the syntax `rot90(A,k)`, the argument `k` must be a built-in type; it cannot be a `fi` object.

`round`

N/A

`setfimath`

N/A

`sfi`

• All properties related to data type must be constant for code generation.

`shiftdim`

The dimensions argument must be a built-in type; it cannot be a `fi` object.

`sign`

N/A

`sin`

N/A

`single`

For the automated workflow, do not use explicit double or single casts in your MATLAB algorithm to insulate functions that do not support fixed-point data types. The automated conversion tool does not support these casts. Instead of using casts, supply a replacement function. For more information, see Function Replacements.

`size`

N/A

`sort`

The dimensions argument must be a built-in type; it cannot be a `fi` object.

`squeeze`

N/A

`sqrt`

• Complex and [Slope Bias] inputs error out.

• Negative inputs yield a 0 result.

`storedInteger`

N/A

`storedIntegerToDouble`

N/A

`sub`

• Code generation in MATLAB does not support the syntax `F.sub(a,b)`. You must use the syntax `sub(F,a,b)`.

`subsasgn`

N/A

`subsref`

N/A

`sum`

Variable-sized inputs are only supported when the `SumMode` property of the governing `fimath` is set to ```Specify precision``` or `Keep LSB`.

`times`

• Any non-`fi` input must be constant; that is, its value must be known at compile time so that it can be cast to a `fi` object.

• When you provide complex inputs to the `times` function inside of a MATLAB Function block, you must declare the input as complex before running the simulation. To do so, go to the Ports and data manager and set the Complexity parameter for all known complex inputs to `On`.

`transpose`

N/A

`tril`

If supplied, the index, k, must be a real and scalar integer value that is not a `fi` object.

`triu`

If supplied, the index, k, must be a real and scalar integer value that is not a `fi` object.

`ufi`

• All properties related to data type must be constant for code generation.

N/A

`uminus`

N/A

`uplus`

N/A

`upperbound`

N/A

`vertcat`

N/A

### HDL Coder

Function

Remarks and Limitations

`hdl.RAM`

This System object is available with MATLAB.

### Histograms in MATLAB

Function

Remarks and Limitations

`hist`

• Histogram bar plotting not supported. Call with at least one output argument.

• If supplied, the second argument `x` must be a scalar constant.

• Inputs must be real.

For the syntax ```[nout, xout] = hist(y,x)```:

• When `y` is a fixed-size vector or variable-length vector:

• `nout` is always a row vector.

• If `x` is a vector, `xout` is a vector with the same orientation as `x`.

• If `x` is a scalar (fixed-size), `xout` is a row vector.

• `nout` and `xout` are column vectors when the following conditions are true:

• `y` is a matrix

• `size(y,1)` and `size(y,2)` do not have fixed length 1

• One of `size(y,1)` and `size(y,2)` has length 1 at run time

• A variable-size`x` is interpreted as a vector input even if it is a scalar at run time.

• If at least one of the inputs is empty, vector orientations in the output can differ from MATLAB.

`histc`

### Image Acquisition Toolbox

If you install Image Acquisition Toolbox™ software, you can generate C and C++ code for the VideoDevice System object. See `imaq.VideoDevice` and Code Generation with VideoDevice System Object.

### Image Processing in MATLAB

FunctionRemarks and Limitations

`im2double`

`rgb2gray`

### Image Processing Toolbox

The following table lists the Image Processing Toolbox™ functions that have been enabled for code generation. You must have the MATLAB Coder™ software installed to generate C code from MATLAB for these functions.

Image Processing Toolbox provides three types of code generation support:

• Functions that generate C code.

• Functions that generate C code that depends on a platform-specific shared library (`.dll`, `.so`, or `.dylib`). Use of a shared library preserves performance optimizations in these functions, but this limits the target platforms for which you can generate code. For more information, see Code Generation for Image Processing.

• Functions that generate C code or C code that depends on a shared library, depending on which target platform you specify in MATLAB Coder. If you specify the generic ```MATLAB Host Computer``` target platform, these functions generate C code that depends on a shared library. If you specify any other target platform, these functions generate C code.

In generated code, each supported toolbox function has the same name, arguments, and functionality as its Image Processing Toolbox counterpart. However, some functions have limitations. The following table includes information about code generation limitations that might exist for each function. In the following table, all the functions generate C code. The table identifies those functions that generate C code that depends on a shared library, and those functions that can do both, depending on which target platform you choose.

FunctionRemarks/Limitations
`adaptthresh`

The `ForegroundPolarity` and `Statistic` arguments must be compile-time constants.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The `NeighborhoodSize` argument must be a compile-time constant.

`affine2d`

When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

`boundarymask`

The `conn` argument must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`bwareaopen`

`BW` must be a 2-D binary image. N-D arrays are not supported. `conn` can only be one of the two-dimensional connectivities (4 or 8) or a 3-by-3 matrix. The 3-D connectivities (6, 18, and 26) are not supported. Matrices of size 3-by-3-by-...-by-3 are not supported. `conn` must be a compile-time constant.

MATLAB Function Block support: No.

`bwboundaries`

The `conn` and `options` arguments must be compile-time constants and the return value `A` can only be a full matrix, not a sparse matrix.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

`bwconncomp`

The input image must be 2-D.

The `conn` argument must be a compile-time constant and the only connectivities supported are 4 or 8. You can specify connectivity as a 3-by-3 matrix, but it can only be `[0 1 0;1 1 1;0 1 0]` or `ones(3)`.

The `CC` struct return value does not include the `PixelIdxList` field.

MATLAB Function Block support: No.

`bwdist`

The `method` argument must be a compile-time constant. Input images must have fewer than 232 pixels.

Generated code for this function uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`bweuler`

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`bwlabel`

When generating code, the parameter `n` must be a compile-time constant.

MATLAB Function Block support: No.

`bwlookup`

For best results, specify an input image of class `logical`.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`bwmorph`

The character vector specifying the operation must be a constant and, for best results, specify an input image of class `logical`.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

`bwpack`

Generated code for this function uses a precompiled platform-specific shared library.

MATLAB Function Block support: Yes.

`bwperim`

Supports only 2-D images. Does not support any no-output-argument syntaxes. The connectivity matrix input argument, `conn`, must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`bwselect`

Supports only the 3 and 4 input argument syntaxes: ```BW2 = bwselect(BW,c,r)``` and `BW2 = bwselect(BW,c,r,n)`. The optional fourth input argument, `n`, must be a compile-time constant. In addition, with code generation, `bwselect` only supports only the 1 and 2 output argument  syntaxes: ```BW2 = bwselect(___)``` or `[BW2, idx] = bwselect(___)`.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`bwtraceboundary`

The `dir`, `fstep`, and `conn` arguments must be compile-time constants.

MATLAB Function Block support: No.

`bwunpack`

Generated code for this function uses a precompiled platform-specific shared library.

MATLAB Function Block support: Yes. The input argument `M` must be a compile-time constant.

`conndef`

Input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

`demosaic`

The `sensorAlignment` argument must be a compile-time constant.

MATLAB Function Block support: Yes.

`edge`

The `method`, `direction`, and `sigma` arguments must be a compile-time constants. In addition, nonprogrammatic syntaxes are not supported. For example, the syntax `edge(im)`, where `edge` does not return a value but displays an image instead, is not supported.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input arguments `thresh` and `sigma` must be compile-time constants.

`fitgeotrans`

The `transformtype` argument must be a compile-time constant. The function supports the following transformation types: `'nonreflectivesimilarity'`, `'similarity'`, `'affine'`, or `'projective'`.

MATLAB Function Block support: Yes.

`fspecial`

Inputs must be compile-time constants. Expressions or variables are allowed if their values do not change.

MATLAB Function Block support: Yes. The input arguments `hsize`, `radius`, `len`, and `theta` must be compile-time constants.

`getrangefromclass`

MATLAB Function Block support: Yes.

`grayconnected`If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`histeq`

All the syntaxes that include indexed images are not supported. This includes all syntaxes that accept `map` as input and return `newmap`.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument `N` must be a compile-time constant.

`hough`

The optional parameter names `'Theta'` and `'RhoResolution'` must be compile-time character vector constants. The optional `Theta` vector must have a bounded size.

MATLAB Function Block support: Yes. The input argument `BW` must be fixed size, the `RhoResolution` parameter must be a compile-time constant, and the `Theta` vector must have a bounded size.

`houghlines`

The optional parameter names `'FillGap'` and `'MinLength'` must be compile-time character vector constants. Their associated values need not be compile-time constants.

MATLAB Function Block support: No.

`houghpeaks`

The optional parameter names `'Threshold'` and `'NHoodSize'` must be compile-time character vector constants. Their associated values need not be compile-time constants.

MATLAB Function Block support: Yes.

`im2int16`

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`im2uint8`

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`im2uint16`If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`im2single`

MATLAB Function Block support: Yes.

`im2double`

MATLAB Function Block support: Yes.

`imabsdiff`

MATLAB Function Block support: Yes.

`imadjust`

Does not support syntaxes that include indexed images. This includes all syntaxes that accept `map` as input and return `newmap`.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imbinarize`

Character vector input arguments must be compile-time constants.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imbothat`

The input image `IM` must be either 2-D or 3-D image. The structuring element input argument `SE` must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imboxfilt`

MATLAB Function Block support: Yes.

`imclearborder`

The optional second input argument, `conn`, must be a compile-time constant. Supports only up to 3-D inputs.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imclose`

The input image `IM` must be either 2-D or 3-D image. The structuring element input argument `SE` must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imcomplement`

Does not support `int64` and `uint64` data types.

MATLAB Function Block support: Yes.

`imcrop`The interactive syntaxes, such as `I2 = imcrop`, are not supported. Indexed images are not supported, including the noninteractive syntax `X2 = imcrop(X,map,rect);`.

MATLAB Function Block support: Yes.

`imdilate`

The input image `IM` must be either 2-D or 3-D image. The `SE`, `PACKOPT`, and `SHAPE` input arguments must be a compile-time constant. The structuring element argument `SE` must be a single element—arrays of structuring elements are not supported. To obtain the same result as that obtained using an array of structuring elements, call the function sequentially.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imerode`

The input image `IM` must be either 2-D or 3-D image. The `SE`, `PACKOPT`, and `SHAPE` input arguments must be a compile-time constant. The structuring element argument `SE` must be a single element—arrays of structuring elements are not supported. To obtain the same result as that obtained using an array of structuring elements, call the function sequentially.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imextendedmax`

The optional third input argument, `conn`, must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imextendedmin`

The optional third input argument, `conn`, must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imfill`

The optional input connectivity, `conn` and the character vector `'holes'` must be compile-time constants.

Supports only up to 3-D inputs.

The interactive mode to select points, `imfill(BW,0,CONN)` is not supported in code generation.

`locations` can be a P-by-1 vector, in which case it contains the linear indices of the starting locations. `locations` can also be a P-by-`ndims(I)` matrix, in which case each row contains the array indices of one of the starting locations. Once you select a format at compile-time, you cannot change it at run time. However, the number of points in locations can be varied at run time.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imfilter`

The input image can be either 2-D or 3-D. The value of the input argument, `options`, must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imfindcircles`

All character vector input arguments and values must be compile-time constants.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

`imgaborfilt`

The `wavelength`, `orientation`, `SpatialFrequencyBandwidth`, and `SpatialAspectRatio` must be compile-time constants.

The filter bank syntax is not supported.

MATLAB Function Block support: Yes.

`imgaussfilt`

Character vector input arguments must be compile-time constants.

When `FilterDomain` is `'spatial'`, if you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imgradient3`

Character vector input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

`imgradientxyz`

Character vector input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

`imhist`

The optional second input argument, `n`, must be a compile-time constant. In addition, nonprogrammatic syntaxes are not supported. For example, the syntaxes where `imhist` displays the histogram are not supported.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument `N` must be a compile-time constant.

`imhmax`

The optional third input argument, `conn`, must be a compile-time constant

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imhmin`

The optional third input argument, `conn`, must be a compile-time constant

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imlincomb`

The `output_class` argument must be a compile-time constant. You can specify up to four input image arguments.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`immse`

MATLAB Function Block support: Yes.

`imopen`

The input image `IM` must be either 2-D or 3-D image. The structuring element input argument `SE` must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imoverlay`

If you specify the `'color'` argument as a character vector, it must be a compile-time constant.

MATLAB Function Block support: Yes.

`impyramid`

The `direction` argument must be a compile-time constant.

MATLAB Function Block support: Yes. The input argument direction must be a compile-time constant.

`imquantize`

MATLAB Function Block support: Yes.

`imread`

Supports reading of 8-bit JPEG images only. The file name input argument must be a valid absolute path or relative path.

This function generates code that uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The file name input argument must be a compile-time constant.

`imreconstruct`

The optional third input argument, `conn`, must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imref2d`

The `XWorldLimits`, `YWorldLimits` and `ImageSize` properties can be set only during object construction. When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

`imref3d`

The `XWorldLimits`, `YWorldLimits`, `ZWorldLimits` and `ImageSize` properties can be set only during object construction. When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

`imregionalmax`

The optional second input argument, `conn`, must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imregionalmin`

The optional second input argument, `conn`, must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imresize`

Does not support indexed images or custom interpolation kernels. All parameter-value pair input arguments must be compile-time constants.

MATLAB Function Block support: Yes. The input arguments `Scale` and `method` must be compile-time constants, and the values of the `OutputSize` parameter, `numrows` and `numcols`, must be compile-time constants.

`imrotate`

The `method` and `bbox` input argument values must be compile-time constants.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument `angle` must be a compile-time constant.

`imtophat`

The input image `IM` must be either 2-D or 3-D image. The structuring element input argument `SE` must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`imtranslate`

The supports only 2-D translation vectors. 3-D translations are not supported

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument `translation` must be a compile-time constant.

`imwarp`

The geometric transformation object input, `tform`, must be either `affine2d` or `projective2d`. Additionally, the interpolation method and optional parameter names must be character vector constants.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument `tform` must be a compile-time constant.

`integralBoxFilter`

The `'NormalizationFactor'` parameter must be a compile-time constant.

MATLAB Function Block support: Yes. The input argument `filtersize` must be a compile-time constant.

`intlut`

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`iptcheckconn`

Input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

`iptcheckmap`

MATLAB Function Block support: Yes.

`lab2rgb`

Character vector input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

`label2idx`

MATLAB Function Block support: No.

`label2rgb`

Referring to the standard syntax:

`RGB = label2rgb(L, map, zerocolor, order)`
• Submit at least two input arguments: the label matrix, `L`, and the colormap matrix, `map`.

• `map` must be an `n-by-3`, `double`, colormap matrix. You cannot use a character vector containing the name of a MATLAB colormap function or a function handle of a colormap function.

• If you set the boundary color `zerocolor` to the same color as one of the regions, `label2rgb` will not issue a warning.

• If you supply a value for `order`, it must be `'noshuffle'`.

MATLAB Function Block support: Yes.

`mean2`

MATLAB Function Block support: Yes.

`medfilt2`

The `padopt` argument must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The neighborhood size input argument must be a compile-time constant.

`multithresh`

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument `N` must be compile-time constant.

`offsetstrel`

The `'ball'` input argument and all other input arguments must be compile-time constants. None of the methods are supported for code generation. When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

`ordfilt2`

The `padopt` argument must be a compile-time constant.

If you choose the generic ```MATLAB Host Computer``` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`otsuthresh`

MATLAB Function Block support: Yes.

`padarray`

Support only up to 3-D inputs.

Input arguments, `padval` and `direction` are expected to be compile-time constants.

MATLAB Function Block support: Yes. The input argument `padsize` must be a compile-time constant.

`projective2d`

When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

`psnr`

MATLAB Function Block support: Yes.

`regionprops`

Supports only 2-D images. Does not support the table output type. Does not accept cell arrays as input—use a comma-separated list instead. Does not support the properties `ConvexArea`, `ConvexHull`, `ConvexImage`, `Solidity`, and `SubarrayIdx`.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

`rgb2gray`

MATLAB Function Block support: Yes.

`rgb2lab`

Character vector input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

`rgb2ycbcr`

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`strel`

All of the input arguments must be compile-time constants. None of the methods are supported for code generation. When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

`stretchlim`

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

`superpixels`

Character vector input arguments must be compile-time constants. The value of `'IsInputLab'` (true or false) must be a compile-time constant.

MATLAB Function Block support: No.

`watershed`

Supports only 2-D images. Supports only 4- or 8-connectivity. Supports only up to 65,535 regions. The output type is always `uint16`.

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

`ycbcr2rgb`

If you choose the generic `MATLAB Host Computer` target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

### Input and Output Arguments in MATLAB

Function

Remarks and Limitations

`nargin`

`nargout`

• For a function with no output arguments, returns `1` if called without a terminating semicolon.

 Note:   This behavior also affects extrinsic calls with no terminating semicolon. `nargout` is `1` for the called function in MATLAB.

### Interpolation and Computational Geometry in MATLAB

Function

Remarks and Limitations

`cart2pol`

`cart2sph`

`inpolygon`

Supports single-precision and double-precision inputs, but uses double-precision arithmetic even if all inputs are single-precision.

`interp1`

• Does not support the `'cubic'` method. Instead, use `'v5cubic'` or `'spline'`.

• The input argument `x` (sample points) must be strictly increasing or strictly decreasing. Indices are not reordered.

• If the input argument `v` (sample values) is a variable-length vector (1-by-`:` or `:`-by-1), the shape of the output `vq` matches the shape in MATLAB.

If the input argument `v` is variable-size, is not a variable-length vector, and becomes a row vector at run time, an error occurs.

• If the input argument `xq` (query points) is variable-size, is not a variable-length vector, and becomes a row or column vector at run time, an error occurs.

• Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`interp1q`

Might not match MATLAB when some `Y` values are `Inf` or `NaN`.

`interp2`

• `Xq` and `Yq` must be the same size. Use `meshgrid` to evaluate on a grid.

• For best results, provide `X` and `Y` as vectors.

• For the `'cubic'` method, reports an error if the grid does not have uniform spacing. In this case, use the `'spline'` method.

• For best results when you use the `'spline'` method:

• Use `meshgrid` to create the inputs `Xq` and `Yq`.

• Use a small number of interpolation points relative to the dimensions of `V`. Interpolating over a large set of scattered points can be inefficient.

`interp3`

• `Xq`, `Yq`, and `Zq` must be the same size. Use `meshgrid` to evaluate on a grid.

• For best results, provide `X`, `Y`, and `Z` as vectors.

• For the `'cubic'` method, reports an error if the grid does not have uniform spacing. In this case, use the `'spline'` method.

• For best results when you use the `'spline'` method:

• Use `meshgrid` to create the inputs `Xq`, `Yq`, and `Zq`.

• Use a small number of interpolation points relative to the dimensions of `V`. Interpolating over a large set of scattered points can be inefficient.

`interpn`

• For best results, provide `X1,X2,...,Xn` as vectors.

• Does not support the `'cubic'` or `'spline'` methods for 2-D and higher interpolation.

• The interpolation method must be a constant character vector.

`meshgrid`

`mkpp`

• The output structure `pp` differs from the `pp` structure in MATLAB. In MATLAB, `ppval` cannot use the `pp` structure from the code generator. For code generation, `ppval` cannot use a `pp` structure created by MATLAB. `unmkpp` can use a MATLAB `pp` structure for code generation.

To create a MATLAB `pp` structure from a `pp` structure created by the code generator:

• In code generation, use `unmkpp` to return the piecewise polynomial details to MATLAB.

• In MATLAB, use `mkpp` to create the `pp` structure.

• If you do not provide `d`, then `coefs` must be two-dimensional and have a fixed number of columns. In this case, the number of columns is the order.

• To define a piecewise constant polynomial, `coefs` must be a column vector or `d` must have at least two elements.

• If you provide `d` and `d` is `1`, `d` must be a constant. Otherwise, if the input to `ppval` is nonscalar, the shape of the output of `ppval` can differ from `ppval` in MATLAB.

• If you provide `d`, it must have a fixed length. One of the following sets of statements must be true:

1. Suppose that `m = length(d)` and ```npieces = length(breaks) - 1```.

```size(coefs,j) = d(j) size(coefs,m+1) = npieces size(coefs,m+2) = order ```
`j` = 1,2,...,m. The dimension `m+2` must be fixed length.

2. Suppose that `m = length(d)` and ```npieces = length(breaks) - 1```.

```size(coefs,1) = prod(d)*npieces size(coefs,2) = order ```
The second dimension must be fixed length.

• If you do not provide `d`, the following statements must be true:

Suppose that `m = length(d)` and ```npieces = length(breaks) - 1```.

```size(coefs,1) = prod(d)*npieces size(coefs,2) = order```
The second dimension must be fixed length.

`pchip`

• Input `x` must be strictly increasing.

• Does not remove `y` entries with `NaN` values.

• If you generate code for the `pp = pchip(x,y)` syntax, you cannot input `pp` to the `ppval` function in MATLAB. To create a MATLAB `pp` structure from a `pp` structure created by the code generator:

• In code generation, use `unmkpp` to return the piecewise polynomial details to MATLAB.

• In MATLAB, use `mkpp` to create the `pp` structure.

`pol2cart`

`polyarea`

`ppval`

The size of output `v` does not match MATLAB when both of the following statements are true:

• The input `x` is a variable-size array that is not a variable-length vector.

• `x` becomes a row vector at run time.

The code generator does not remove the singleton dimensions. However, MATLAB might remove singleton dimensions.

For example, suppose that `x` is a :4-by-:5 array (the first dimension is variable size with an upper bound of 4 and the second dimension is variable size with an upper bound of 5). Suppose that `ppval(pp,0)` returns a 2-by-3 fixed-size array. `v` has size 2-by-3-by-:4-by-:5. At run time, suppose that, size(x,1) =1 and size (x,2) = 5. In the generated code, the size(v) is [2,3,1,5]. In MATLAB, the size is [2,3,5].

`rectint`

`sph2cart`

`spline`

• Input `x` must be strictly increasing.

• Does not remove `Y` entries with `NaN` values.

• Does not report an error for infinite endslopes in `Y`.

• If you generate code for the `pp = spline(x,Y)` syntax, you cannot input `pp` to the `ppval` function in MATLAB. To create a MATLAB `pp` structure from a `pp` structure created by the code generator:

• In code generation, use `unmkpp` to return the piecewise polynomial details to MATLAB.

• In MATLAB, use `mkpp` to create the `pp` structure.

`unmkpp`

• `pp` must be a valid piecewise polynomial structure created by `mkpp`, `spline`, or `pchip` in MATLAB or by the code generator.

• Does not support `pp` structures created by `interp1` in MATLAB.

### Linear Algebra in MATLAB

FunctionRemarks and Limitations

`bandwidth`

`isbanded`

`isdiag`

`ishermitian`

`istril`

`istriu`

`issymmetric`

`linsolve`

• The option structure must be a constant.

• Supports only a scalar option structure input. It does not support arrays of option structures.

• Only optimizes these cases:

• `UT`

• `LT`

• `UHESS` = `true` (the `TRANSA` can be either `true` or `false`)

• `SYM` = `true` and `POSDEF` = `true`

Other options are equivalent to using `mldivide`.

`lsqnonneg`

• You must enable support for variable-size arrays.

• The exit message in the output structure `output` (the fifth output) is not translated.

`null`

• Might return a different basis than MATLAB

• Does not support rational basis option (second input)

`orth`

• Can return a different basis than MATLAB

`rsf2csf`

`schur`

Can return a different Schur decomposition in generated code than in MATLAB.

`sqrtm`

### MATLAB Compiler

C and C++ code generation for the following functions requires the MATLAB Compiler™ software.

Function

Remarks and Limitations

`isdeployed`

• Returns true and false as appropriate for MEX and SIM targets

• Returns false for other targets

`ismcc`

• Returns true and false as appropriate for MEX and SIM targets.

• Returns false for other targets.

### Matrices and Arrays in MATLAB

Function

Remarks and Limitations

`abs`

`all`

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`angle`

`any`

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`blkdiag`

`bsxfun`

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`cat`

`circshift`

Does not support cell arrays for the first argument.

`colon`

• Does not accept complex inputs.

• The input `i` cannot have a logical value.

• Does not accept vector inputs.

• Inputs must be constants.

• Uses single-precision arithmetic to produce single-precision results.

`compan`

`cond`

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`cov`

`cross`

`cumprod`

Does not support logical inputs. Cast input to `double` first.

`cumsum`

Does not support logical inputs. Cast input to `double` first.

`det`

`diag`

• If supplied, the argument representing the order of the diagonal matrix must be a real and scalar integer value.

• For variable-size inputs that are variable-length vectors (1-by-: or :-by-1), `diag`:

• Treats the input as a vector input.

• Returns a matrix with the given vector along the specified diagonal.

• For variable-size inputs that are not variable-length vectors, `diag`:

• Treats the input as a matrix.

• Does not support inputs that are vectors at run time.

• Returns a variable-length vector.

If the input is variable-size (:m-by-:n) and has shape 0-by-0 at run time, the output is 0-by-1 not 0-by-0. However, if the input is a constant size 0-by-0, the output is `[]`.

• For variable-size inputs that are not variable-length vectors (1-by-: or :-by-1), `diag` treats the input as a matrix from which to extract a diagonal vector. This behavior occurs even if the input array is a vector at run time. To force `diag` to build a matrix from variable-size inputs that are not 1-by-: or :-by-1, use:

• `diag(x(:))` instead of `diag(x)`

• `diag(x(:),k)` instead of `diag(x,k)`

• Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`diff`

`dot`

`eig`

• `V` might represent a different basis of eigenvectors, and the eigenvalues in `D` might not be in the same order as in MATLAB.

• For the generalized eigenvalue problem, ```[V,D] = eig(A,B)```, the `'qz'` option is always used.

• For the standard eigenvalue problem, ```[V,D] = eig(A)```, when `A` is Hermitian, `schur` is used to calculate `V` and `D`. Otherwise, the results of `[V,D] = eig(A)` are similar to those obtained using `[V,D] = eig(A,eye(size(A)),'qz')` in MATLAB, except that the columns of `V` are normalized.

• Options `'balance'`, and `'nobalance'` are not supported for the standard eigenvalue problem. `'chol'` is not supported for the symmetric generalized eigenvalue problem.

• Outputs are of complex type.

• Does not support the option to calculate left eigenvectors.

`eye`

• `classname` must be a built-in MATLAB numeric type. Does not invoke the static `eye` method for other classes. For example, `eye(m, n, 'myclass')` does not invoke `myclass.eye(m,n)`.

• Size arguments must have a fixed size.

`false`

• Dimensions must be real, nonnegative, integers.

`find`

• Issues an error if a variable-size input becomes a row vector at run time.

 Note:   This limitation does not apply when the input is scalar or a variable-length row vector.
• For variable-size inputs, the shape of empty outputs, 0-by-0, 0-by-1, or 1-by-0, depends on the upper bounds of the size of the input. The output might not match MATLAB when the input array is a scalar or [] at run time. If the input is a variable-length row vector, the size of an empty output is 1-by-0, otherwise it is 0-by-1.

• Always returns a variable-length vector. Even when you provide the output vector `k`, the output cannot be fixed-size because the output can contain fewer than k elements. For example, `find(x,1)` returns a variable-length vector with 1 or 0 elements.

`flip`

Does not support cell arrays for the first argument.

`flipdim`

Does not support cell arrays for the first argument.

`fliplr`

Does not support cell arrays.

`flipud`

Does not support cell arrays.

`full`

`hadamard`

`n` must be a fixed-size scalar.

`hankel`

`hilb`

`ind2sub`

`inv`

Singular matrix inputs can produce nonfinite values that differ from MATLAB results.

`invhilb`

`ipermute`

`iscolumn`

`isempty`

`isequal`

`isequaln`

`isfinite`

`isfloat`

`isinf`

`isinteger`

`islogical`

`ismatrix`

`isnan`

`isrow`

`issparse`

`isvector`

`kron`

`length`

`linspace`

`logspace`

`lu`

`magic`

`max`

• If specified, `dim` must be a constant.

`min`

• If specified, `dim` must be a constant.

`ndgrid`

`ndims`

`nnz`

`nonzeros`

`norm`

`normest`

`numel`

`ones`

• Dimensions must be real, nonnegative integers.

• The input `optimfun` must be a function supported for code generation.

`pascal`

`permute`

`pinv`

`planerot`

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`prod`

`qr`

`rand`

`randi`

• The data type (class) must be a built-in MATLAB numeric type. Does not invoke the static `randi` method for other classes. For example, `randi(imax,sz,'myclass')` does not invoke `myclass.randi(imax,sz)`.

• Size arguments must have a fixed size.

• Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`randn`

`randperm`

`rank`

`rcond`

`repelem`

The input must be a vector or matrix. The input cannot be a multidimensional array.

`repmat`

Size arguments must have a fixed size.

`reshape`

`rng`

• Supports only the `'twister'`, `'v5normal'`, and `'v4'` generators.

• Does not support the `'shuffle'` input.

• For a MEX target:

• If extrinsic calls are disabled or `rng` is called inside a `parfor` loop, the output of `rng` in the MEX function is not compatible with the `rng` function in MATLAB. You cannot pass the output of `s = rng` from the MEX function to `rng` in MATLAB.

• If extrinsic calls are enabled and `rng` is not called from inside a `parfor` loop, only `rng` can access the data in the structure that `rng` returns.

`rosser`

`rot90`

Does not support cell arrays for the first argument.

`shiftdim`

`sign`

`size`

`sort`

• Does not support cell arrays for the first argument.

• If the input is a complex type, `sort` orders the output according to absolute value. When `x` is a complex type that has all zero imaginary parts, use `sort(real(x))` to compute the sort order for real types. See Code Generation for Complex Data with Zero-Valued Imaginary Parts.

`sortrows`

• Does not support cell arrays for the first argument.

• If the input is a complex type, `sortrows` orders the output according to absolute value. When `x` is a complex type that has all zero imaginary parts, use `sortrows(real(x))` to compute the sort order for real types. See Code Generation for Complex Data with Zero-Valued Imaginary Parts.

`squeeze`

Does not support cell arrays.

`sub2ind`

`subspace`

`sum`

`toeplitz`

`trace`

`tril`

• If supplied, the argument representing the order of the diagonal matrix must be a real and scalar integer value.

`triu`

• If supplied, the argument representing the order of the diagonal matrix must be a real and scalar integer value.

`true`

• Dimensions must be real, nonnegative, integers.

`vander`

`wilkinson`

`n` must be a fixed-size scalar.

`zeros`

• Dimensions must be real, nonnegative, integers.

### Neural Network Toolbox

You can use `genFunction` in the Neural Network Toolbox™ to generate a standalone MATLAB function for a trained neural network. You can generate C/C++ code from this standalone MATLAB function. To generate Simulink blocks, use the `genSim` function. See Deploy Trained Neural Network Functions.

### Numerical Integration and Differentiation in MATLAB

Function

Remarks and Limitations

`cumtrapz`

`del2`

`diff`

• If supplied, the arguments representing the number of times to apply `diff` and the dimension along which to calculate the difference must be constants.

`gradient`

`ode23`

• All `odeset` option arguments must be constant.

• Does not support a constant mass matrix in the options structure. Provide a mass matrix as a function .

• You must provide at least the two output arguments `T` and `Y`.

• Input types must be homogeneous—all double or all single.

• Variable-sizing support must be enabled. Requires dynamic memory allocation when `tspan` has two elements or you use event functions.

`ode45`

• All `odeset` option arguments must be constant.

• Does not support a constant mass matrix in the options structure. Provide a mass matrix as a function .

• You must provide at least the two output arguments `T` and `Y`.

• Input types must be homogeneous—all double or all single.

• Variable-sizing support must be enabled. Requires dynamic memory allocation when `tspan` has two elements or you use event functions.

`odeget`

The `name` argument must be constant.

`odeset`

All inputs must be constant.

`quad2d`

• Generates a warning if the size of the internal storage arrays is not large enough. If a warning occurs, a possible workaround is to divide the region of integration into pieces and sum the integrals over each piece.

`quadgk`

`trapz`

### Optimization Functions in MATLAB

Function

Remarks and Limitations

`fminbnd`

• Does not support the problem structure argument.

• Ignores the `Display` option. During execution, does not print status information, including early termination. To test the exit condition, use the third output argument.

• The output structure does not include the `algorithm` or `message` fields.

• Ignores the `OutputFcn` and `PlotFcns` options.

`fminsearch`

• Ignores the `Display` option. During execution, does not print status information, including early termination. Test the third output argument for the exit condition.

• The output structure does not include the `algorithm` or `message` fields.

• Ignores the `OutputFcn` and `PlotFcns` options.

`fzero`

• The first argument must be a function handle. Does not support structure or character vector inputs for the first argument.

• Supports up to three output arguments. Does not support the fourth output argument (the `output` structure).

`optimget`

Input parameter names must be constant.

`optimset`

• Does not support the syntax that has no input or output arguments:

`optimset`

• Functions specified in the options must be supported for code generation.

• The fields of the options structure `oldopts` must be fixed-size fields.

• For code generation, optimization functions ignore the `Display` option.

• Does not support the additional options in an options structure created by the Optimization Toolbox™ `optimset` function. If an input options structure includes the additional Optimization Toolbox options, the output structure does not include them.

### Phased Array System Toolbox

C and C++ code generation for the following functions and System objects requires the Phased Array System Toolbox™ software.

NameRemarks and Limitations
Antenna and Microphone Elements

`aperture2gain`

Does not support variable-size inputs.

`azel2phithetapat`

Does not support variable-size inputs.

`azel2uvpat`

Does not support variable-size inputs.

`circpol2pol`

Does not support variable-size inputs.

`gain2aperture`

Does not support variable-size inputs.

`phased.CosineAntennaElement`
• `pattern`, `patternAzimuth`, `patternElevation`, and `plotResponse` methods are not supported.

`phased.CrossedDipoleAntennaElement`
• `pattern`, `patternAzimuth`, `patternElevation`, and `plotResponse` methods are not supported.

`phased.CustomAntennaElement`
• `pattern`, `patternAzimuth`, `patternElevation`, and `plotResponse` methods are not supported.

`phased.CustomMicrophoneElement`
• `pattern`, `patternAzimuth`, `patternElevation`, and `plotResponse` methods are not supported.

`phased.IsotropicAntennaElement`
• `pattern`, `patternAzimuth`, `patternElevation`, and `plotResponse` methods are not supported.

`phased.OmnidirectionalMicrophoneElement`
• `pattern`, `patternAzimuth`, `patternElevation`, and `plotResponse` methods are not supported.

`phased.ShortDipoleAntennaElement`
• `pattern`, `patternAzimuth`, `patternElevation`, and `plotResponse` methods are not supported.

`phitheta2azelpat`

Does not support variable-size inputs.

`phitheta2uvpat`

Does not support variable-size inputs.

`pol2circpol`

Does not support variable-size inputs.

`polellip`

Does not support variable-size inputs.

`polloss`

Does not support variable-size inputs.

`polratio`

Does not support variable-size inputs.

`polsignature`

• Does not support variable-size inputs.

• Supported only when output arguments are specified.

`stokes`

• Does not support variable-size inputs.

• Supported only when output arguments are specified.

`uv2azelpat`

Does not support variable-size inputs.

`uv2phithetapat`

Does not support variable-size inputs.

Array Geometries and Analysis

`az2broadside`

Does not support variable-size inputs.

`broadside2az`

Does not support variable-size inputs.

`pilotcalib`

Does not support variable-size inputs.

`phased.ArrayGain`
• Does not support arrays containing polarized antenna elements, that is, the `phased.ShortDipoleAntennaElement` or `phased.CrossedDipoleAntennaElement` antennas.

`phased.ArrayResponse`See System Objects in MATLAB Code Generation.
`phased.ConformalArray`
• `pattern`, `patternAzimuth`, `patternElevation`, `plotResponse`, and `viewArray` methods are not supported.

`phased.ElementDelay`See System Objects in MATLAB Code Generation.
`phased.PartitionedArray`
• `pattern`, `patternAzimuth`, `patternElevation`, `plotResponse`, and `viewArray` methods are not supported.

`phased.ReplicatedSubarray`
• `pattern`, `patternAzimuth`, `patternElevation`, `plotResponse`, and `viewArray` methods are not supported.

`phased.SteeringVector`See System Objects in MATLAB Code Generation.
`phased.UCA`
• `pattern`, `patternAzimuth`, `patternElevation`, `plotResponse`, and `viewArray` methods are not supported.

`phased.ULA`
• `pattern`, `patternAzimuth`, `patternElevation`, `plotResponse`, and `viewArray` methods are not supported.

`phased.URA`
• `pattern`, `patternAzimuth`, `patternElevation`, `plotResponse`, and `viewArray` methods are not supported.

`taylortaperc`

Does not support variable-size inputs.

`phased.Collector`See System Objects in MATLAB Code Generation.
`phased.Radiator` See System Objects in MATLAB Code Generation.
`phased.WidebandCollector`
`phased.WidebandRadiator`See System Objects in MATLAB Code Generation.

`sensorsig`

Does not support variable-size inputs.

`delayseq`

Does not support variable-size inputs.

`noisepow`

Does not support variable-size inputs.

`phased.ReceiverPreamp`See System Objects in MATLAB Code Generation.
`phased.Transmitter`See System Objects in MATLAB Code Generation.

`systemp`

Does not support variable-size inputs.

Waveform Design and Analysis

`ambgfun`

• Does not support variable-size inputs.

• Supported only when output arguments are specified.

`pambgfun`

• Does not support variable-size inputs.

• Supported only when output arguments are specified.

`phased.FMCWWaveform`
• `plot` method is not supported.

.
`phased.LinearFMWaveform`
• `plot` method is not supported.

`phased.MFSKWaveform`
• `plot` method is not supported.

`phased.PhaseCodedWaveform`
• `plot` method is not supported.

`phased.RectangularWaveform`
• `plot` method is not supported.

`phased.SteppedFMWaveform`
• `plot` method is not supported.

`range2bw`

Does not support variable-size inputs.

`range2time`

Does not support variable-size inputs.

`time2range`

Does not support variable-size inputs.

`unigrid`

Does not support variable-size inputs.

Beamforming

`cbfweights`

Does not support variable-size inputs.

`lcmvweights`

Does not support variable-size inputs.

`mvdrweights`

Does not support variable-size inputs.

`phased.FrostBeamformer`
`phased.GSCBeamformer`See System Objects in MATLAB Code Generation.
`phased.LCMVBeamformer`See System Objects in MATLAB Code Generation.
`phased.MVDRBeamformer`See System Objects in MATLAB Code Generation.
`phased.PhaseShiftBeamformer`See System Objects in MATLAB Code Generation.
`phased.SteeringVector`See System Objects in MATLAB Code Generation.
`phased.SubbandMVDRBeamformer`See System Objects in MATLAB Code Generation.
`phased.SubbandPhaseShiftBeamformer`See System Objects in MATLAB Code Generation.
`phased.TimeDelayBeamformer`
`phased.TimeDelayLCMVBeamformer`

`sensorcov`

Does not support variable-size inputs.

`steervec`

Does not support variable-size inputs.

Direction of Arrival (DOA) Estimation

`aictest`

Does not support variable-size inputs.

`espritdoa`

Does not support variable-size inputs.

`gccphat`

Does not support variable-size inputs.

`mdltest`

Does not support variable-size inputs.

`musicdoa`

Does not support variable-size inputs.

`phased.BeamscanEstimator`See System Objects in MATLAB Code Generation.
`phased.BeamscanEstimator2D`See System Objects in MATLAB Code Generation.
`phased.BeamspaceESPRITEstimator`See System Objects in MATLAB Code Generation.
`phased.ESPRITEstimator`See System Objects in MATLAB Code Generation.
`phased.GCCEstimator`See System Objects in MATLAB Code Generation.
`phased.MUSICEstimator`See System Objects in MATLAB Code Generation.
`phased.MUSICEstimator2D`See System Objects in MATLAB Code Generation.
`phased.MVDREstimator`See System Objects in MATLAB Code Generation.
`phased.MVDREstimator2D`See System Objects in MATLAB Code Generation.
`phased.RootMUSICEstimator`See System Objects in MATLAB Code Generation.
`phased.RootWSFEstimator`See System Objects in MATLAB Code Generation.
`phased.SumDifferenceMonopulseTracker`See System Objects in MATLAB Code Generation.
`phased.SumDifferenceMonopulseTracker2D`See System Objects in MATLAB Code Generation.

`rootmusicdoa`

Does not support variable-size inputs.

`spsmooth`

Does not support variable-size inputs.

`dopsteeringvec`

Does not support variable-size inputs.

`phased.ADPCACanceller`See System Objects in MATLAB Code Generation.
`phased.AngleDopplerResponse`See System Objects in MATLAB Code Generation.
`phased.DPCACanceller`See System Objects in MATLAB Code Generation.
`phased.STAPSMIBeamformer`See System Objects in MATLAB Code Generation.

`val2ind`

Does not support variable-size inputs.

Detection, Range, and Doppler Estimation

`albersheim`

Does not support variable-size inputs.

`beat2range`

Does not support variable-size inputs.

`dechirp`

Does not support variable-size inputs.

`npwgnthresh`

Does not support variable-size inputs.

`phased.CFARDetector`
`phased.CFARDetector2D`
`phased.MatchedFilter`
• The `CustomSpectrumWindow` property is not supported.

`phased.RangeDopplerResponse`
• The `CustomRangeWindow` and `CustomDopplerWindow` properties are not supported.

• The `plotResponse` method is not supported.

`phased.StretchProcessor`
`phased.TimeVaryingGain`

`pulsint`

Does not support variable-size inputs.

`radareqpow`

Does not support variable-size inputs.

`radareqrng`

Does not support variable-size inputs.

`radareqsnr`

Does not support variable-size inputs.

`radarvcd`

• Does not support variable-size inputs.

• Supported only when output arguments are specified.

`range2beat`

Does not support variable-size inputs.

`rdcoupling`

Does not support variable-size inputs.

`rocpfa`

• Does not support variable-size inputs.

• Supported only when output arguments are specified.

• The `NonfluctuatingNoncoherent` signal type is not supported.

`rocsnr`

• Does not support variable-size inputs.

• Supported only when output arguments are specified.

• The `NonfluctuatingNoncoherent` signal type is not supported.

`shnidman`

Does not support variable-size inputs.

`stretchfreq2rng`

Does not support variable-size inputs.

Targets, Interference, and Signal Propagation

`billingsleyicm`

Does not support variable-size inputs.

`depressionang`

Does not support variable-size inputs.

`effearthradius`

Does not support variable-size inputs.

`fspl`

Does not support variable-size inputs.

`fogpl`

Does not support variable-size inputs.

`gaspl`

Does not support variable-size inputs.

`grazingang`

Does not support variable-size inputs.

`horizonrange`

Does not support variable-size inputs.

`phased.BackscatterRadarTarget`See System Objects in MATLAB Code Generation
`phased.BarrageJammer`See System Objects in MATLAB Code Generation.
`phased.ConstantGammaClutter`See System Objects in MATLAB Code Generation.
`phased.FreeSpace`
`phased.LOSChannel`See System Objects in MATLAB Code Generation
`phased.RadarTarget`See System Objects in MATLAB Code Generation.
`phased.TwoRayChannel`See System Objects in MATLAB Code Generation.
`phased.WidebandFreeSpace`See System Objects in MATLAB Code Generation.
`phased.WidebandBackscatterRadarTarget`See System Objects in MATLAB Code Generation.
`phased.WidebandLOSChannel`See System Objects in MATLAB Code Generation
`phased.WidebandTwoRayChannel`See System Objects in MATLAB Code Generation

`physconst`

Does not support variable-size inputs.

`surfacegamma`

Does not support variable-size inputs.

`surfclutterrcs`

Does not support variable-size inputs.

`rainpl`

Does not support variable-size inputs.

Motion Modeling and Coordinate Systems

`azel2phitheta`

Does not support variable-size inputs.

`azel2uv`

Does not support variable-size inputs.

`azelaxes`

Does not support variable-size inputs.

`cart2sphvec`

Does not support variable-size inputs.

`dop2speed`

Does not support variable-size inputs.

`global2localcoord`

Does not support variable-size inputs.

`local2globalcoord`

Does not support variable-size inputs.

`phased.Platform`See System Objects in MATLAB Code Generation.

`phitheta2azel`

Does not support variable-size inputs.

`phitheta2uv`

Does not support variable-size inputs.

`radialspeed`

Does not support variable-size inputs.

`rangeangle`

Does not support variable-size inputs.

`rotx`

Does not support variable-size inputs.

`roty`

Does not support variable-size inputs

`rotz`

Does not support variable-size inputs.

`speed2dop`

Does not support variable-size inputs.

`sph2cartvec`

Does not support variable-size inputs.

`uv2azel`

Does not support variable-size inputs.

`uv2phitheta`

Does not support variable-size inputs.

### Polynomials in MATLAB

Function

Remarks and Limitations

`poly`

`polyder`

The output can contain fewer `NaN`s than the MATLAB output. However, if the input contains a `NaN`, the output contains at least one `NaN`.

`polyeig`

• The basis of the eigenvectors can be different in the generated code than in MATLAB. In general, in the eigenvalues output, the eigenvalues for real inputs are not sorted so that complex conjugate pairs are adjacent.

• Differences in eigenvectors and ordering of eigenvalues can lead to differences in the condition numbers output.

`polyfit`

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`polyint`

`polyval`

`polyvalm`

`roots`

• Output is variable size.

• Output is complex.

• Roots are not always in the same order as MATLAB.

• Roots of poorly conditioned polynomials do not always match MATLAB.

### Programming Utilities in MATLAB

Function

Remarks and Limitations

`mfilename`

### Relational Operators in MATLAB

Function

Remarks and Limitations

`eq`

You cannot use `eq` to test equality between an enumeration member and a character array or cell array of character arrays.

`ge`

`gt`

`le`

`lt`

`ne`

You cannot use `ne` to test inequality between an enumeration member and a character array or cell array of character arrays.

### Robotics System Toolbox

C/C++ code generation for the following functions requires the Robotics System Toolbox™ software.

NameRemarks and Limitations
Algorithm Design
`robotics.BinaryOccupancyGrid`

Supports MATLAB Function block: No

`robotics.OccupancyGrid`

Supports MATLAB Function block: No

`robotics.OdometryMotionModel`

Supports MATLAB Function block: No

`robotics.ParticleFilter`

Supports MATLAB Function block: No

`robotics.PRM`

Supports MATLAB Function block: No

The `map` input must be specified on creation of the `PRM` object.

`robotics.PurePursuit`

Supports MATLAB Function block: No

`robotics.VectorFieldHistogram`

Supports MATLAB Function block: No

Coordinate System Transformations
`angdiff`

Supports MATLAB Function block: Yes

`axang2quat`

Supports MATLAB Function block: Yes

`axang2rotm`

Supports MATLAB Function block: Yes

`axang2tform`

Supports MATLAB Function block: Yes

`cart2hom`

Supports MATLAB Function block: Yes

`eul2quat`

Supports MATLAB Function block: Yes

`eul2rotm`

Supports MATLAB Function block: Yes

`eul2tform`

Supports MATLAB Function block: Yes

`hom2cart`

Supports MATLAB Function block: Yes

`quat2axang`

Supports MATLAB Function block: Yes

`quat2eul`

Supports MATLAB Function block: Yes

`quat2rotm`

Supports MATLAB Function block: Yes

`quat2tform`

Supports MATLAB Function block: Yes

`rotm2axang`

Supports MATLAB Function block: Yes

`rotm2eul`

Supports MATLAB Function block: Yes

`rotm2quat`

Supports MATLAB Function block: Yes

`rotm2tform`

Supports MATLAB Function block: Yes

`tform2axang`

Supports MATLAB Function block: Yes

`tform2eul`

Supports MATLAB Function block: Yes

`tform2quat`

Supports MATLAB Function block: Yes

`tform2rotm`

Supports MATLAB Function block: Yes

`tform2trvec`

Supports MATLAB Function block: Yes

`trvec2tform`

Supports MATLAB Function block: Yes

### Rounding and Remainder Functions in MATLAB

Function

Remarks and Limitations

`ceil`

`fix`

`floor`

`mod`

• Performs the arithmetic using the output class. Results might not match MATLAB due to differences in rounding errors.

If one of the inputs has type `int64` or `uint64`, then both inputs must have the same type.

`rem`

• Performs the arithmetic using the output class. Results might not match MATLAB due to differences in rounding errors.

• If one of the inputs has type `int64` or `uint64`, then both inputs must have the same type.

`round`

Supports only the syntax `Y = round(X)`.

### Set Operations in MATLAB

Function

Remarks and Limitations

`intersect`

• Does not support cell arrays for the first or second arguments.

• When you do not specify the `'rows'` option:

• Inputs `A` and `B` must be vectors. If you specify the `'legacy'` option, inputs `A` and `B` must be row vectors.

• The first dimension of a variable-size row vector must have fixed length 1. The second dimension of a variable-size column vector must have fixed length 1.

• The input `[]` is not supported. Use a 1-by-0 or 0-by-1 input, for example, `zeros(1,0)`, to represent the empty set.

• If you specify the `'legacy'` option, empty outputs are row vectors, 1-by-0, never 0-by-0.

• When you specify both the `'legacy'` option and the `'rows'` option, the outputs `ia` and `ib` are column vectors. If these outputs are empty, they are 0-by-1, never 0-by-0, even if the output `C` is 0-by-0.

• When the `setOrder` is `'sorted'` or when you specify the `'legacy'` option, the inputs must already be sorted in ascending order. The first output, `C`, is sorted in ascending order.

• Complex inputs must be `single` or `double`.

• When one input is complex and the other input is real, do one of the following:

• Set `setOrder` to `'stable'`.

• Sort the real input in complex ascending order (by absolute value). Suppose the real input is `x`. Use `sort(complex(x))`or `sortrows(complex(x))`.

`ismember`

• Does not support cell arrays for the first or second arguments.

• Complex inputs must be `single` or `double`.

`issorted`

• Does not support cell arrays for the first argument.

`setdiff`

• Does not support cell arrays for the first or second arguments.

• When you do not specify the `'rows'` option:

• Inputs `A` and `B` must be vectors. If you specify the `'legacy'` option, inputs `A` and `B` must be row vectors.

• The first dimension of a variable-size row vector must have fixed length 1. The second dimension of a variable-size column vector must have fixed length 1.

• Do not use `[]` to represent the empty set. Use a 1-by-0 or 0-by-1 input, for example, `zeros(1,0)`, to represent the empty set.

• If you specify the `'legacy'` option, empty outputs are row vectors, 1-by-0, never 0-by-0.

• When you specify both the `'legacy'` and `'rows'` options, the output `ia` is a column vector. If `ia` is empty, it is 0-by-1, never 0-by-0, even if the output `C` is 0-by-0.

• When the `setOrder` is not `'stable'` or when you specify the `'legacy'` option, the inputs must already be sorted in ascending order. The first output, `C`, is sorted in ascending order.

• Complex inputs must be `single` or `double`.

• When one input is complex and the other input is real, do one of the following:

• Set `setOrder` to `'stable'`.

• Sort the real input in complex ascending order (by absolute value). Suppose the real input is `x`. Use `sort(complex(x))`or `sortrows(complex(x))`.

`setxor`

• Does not support cell arrays for the first or second arguments.

• When you do not specify the `'rows'` option:

• Inputs `A` and `B` must be vectors with the same orientation. If you specify the `'legacy'` option, inputs `A` and `B` must be row vectors.

• The first dimension of a variable-size row vector must have fixed length 1. The second dimension of a variable-size column vector must have fixed length 1.

• The input `[]` is not supported. Use a 1-by-0 or 0-by-1 input, for example , `zeros(1,0)`, to represent the empty set.

• If you specify the `'legacy'` option, empty outputs are row vectors, 1-by-0, never 0-by-0.

• When you specify both the `'legacy'` option and the `'rows'` option, the outputs `ia` and `ib` are column vectors. If these outputs are empty, they are 0-by-1, never 0-by-0, even if the output `C` is 0-by-0.

• When the `setOrder` is not `'stable'` or when you specify the `'legacy'` flag, the inputs must already be sorted in ascending order. The first output, `C`, is sorted in ascending order.

• Complex inputs must be `single` or `double`.

• When one input is complex and the other input is real, do one of the following:

• Set `setOrder` to `'stable'`.

• Sort the real input in complex ascending order (by absolute value). Suppose the real input is `x`. Use `sort(complex(x))`or `sortrows(complex(x))`.

`union`

• Does not support cell arrays for the first or second arguments.

• When you do not specify the `'rows'` option:

• Inputs `A` and `B` must be vectors with the same orientation. If you specify the `'legacy'` option, inputs `A` and `B` must be row vectors.

• The first dimension of a variable-size row vector must have fixed length 1. The second dimension of a variable-size column vector must have fixed length 1.

• The input` []` is not supported. Use a 1-by-0 or 0-by-1 input, for example , `zeros(1,0)`, to represent the empty set.

• If you specify the `'legacy'` option, empty outputs are row vectors, 1-by-0, never 0-by-0.

• When you specify both the `'legacy'` option and the `'rows'` option, the outputs `ia` and `ib` are column vectors. If these outputs are empty, they are 0-by-1, never 0-by-0, even if the output `C` is 0-by-0.

• When the `setOrder` is not `'stable'` or when you specify the `'legacy'` option, the inputs must already be sorted in ascending order. The first output, `C`, is sorted in ascending order.

• Complex inputs must be `single` or `double`.

• When one input is complex and the other input is real, do one of the following:

• Set `setOrder` to `'stable'`.

• Sort the real input in complex ascending order (by absolute value). Suppose the real input is `x`. Use `sort(complex(x))`or `sortrows(complex(x))`.

`unique`

• Does not support cell arrays for the first argument.

• When you do not specify the`'rows'` option:

• The input `A` must be a vector. If you specify the `'legacy'` option, the input `A` must be a row vector.

• The first dimension of a variable-size row vector must have fixed length 1. The second dimension of a variable-size column vector must have fixed length 1.

• The input `[]` is not supported. Use a 1-by-0 or 0-by-1 input, for example, `zeros(1,0)`, to represent the empty set.

• If you specify the `'legacy'` option, empty outputs are row vectors, 1-by-0, never 0-by-0.

• When you specify both the `'rows'` option and the `'legacy'`option, outputs `ia` and `ic` are column vectors. If these outputs are empty, they are 0-by-1, even if the output `C` is 0-by-0.

• When the `setOrder` is not `'stable'` or when you specify the `'legacy'` option, the input `A` must already be sorted in ascending order. The first output, `C`, is sorted in ascending order.

• Complex inputs must be `single` or `double`.

### Signal Processing in MATLAB

FunctionRemarks and Limitations

`chol`

`conv`

`fft`

`fft2`

`fftn`

The `siz` argument must have a fixed size.

`fftshift`

`filter`

• If supplied, `dim` must be a constant.

• v

`freqspace`

`ifft`

`ifft2`

Does not support the `'symmetric'` option.

`ifftn`

• Does not support the `'symmetric'` option.

• The `siz` argument must have a fixed size.

`ifftshift`

`svd`

Uses a different `SVD` implementation than MATLAB. Because the singular value decomposition is not unique, left and right singular vectors might differ from those computed by MATLAB.

`zp2tf`

### Signal Processing Toolbox

C and C++ code generation for the following functions requires the Signal Processing Toolbox™ software. These functions do not support variable-size inputs, you must define the size and type of the function inputs. For more information, see Specifying Inputs in Code Generation from MATLAB .

 Note:   Many Signal Processing Toolbox functions require constant inputs in generated code. To specify a constant input for `codegen`, use `coder.Constant`.
Function Remarks/Limitations

`barthannwin`

Window length must be a constant. Expressions or variables are allowed if their values do not change.

`bartlett`

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.

`bitrevorder`

`blackman`

Window length must be a constant. Expressions or variables are allowed if their values do not change.

`blackmanharris`

Window length must be a constant. Expressions or variables are allowed if their values do not change.

`bohmanwin`

Window length must be a constant. Expressions or variables are allowed if their values do not change.

`buttap`

Filter order must be a constant. Expressions or variables are allowed if their values do not change.

`butter`

Filter coefficients must be constants. Expressions or variables are allowed if their values do not change.

`buttord`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`cfirpm`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`cheb1ap`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`cheb2ap`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`cheb1ord`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`cheb2ord`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`chebwin`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`cheby1`

All Inputs must be constants. Expressions or variables are allowed if their values do not change.

`cheby2`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`db2pow`

`dct`

C and C++ code generation for `dct` requires DSP System Toolbox software.

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.

`downsample`

`dpss`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`ellip`

Inputs must be constant. Expressions or variables are allowed if their values do not change.

`ellipap`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`ellipord`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`filtfilt`

Filter coefficients must be constants. Expressions or variables are allowed if their values do not change.

Code generation does not support second-order sections as input. You must use transfer functions.

`findpeaks`

`fir1`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`fir2`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`fircls`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`fircls1`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`firls`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`firpm`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`firpmord`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`flattopwin`

All inputs must be constants. Expressions or variables are allowed if their values do not change.

`freqz`

• Does not support variable-size inputs.

• When called with no output arguments, and without a semicolon at the end, `freqz` returns the complex frequency response of the input filter, evaluated at 512 points.

If the semicolon is added, the function produces a plot of the magnitude and phase response of the filter.

`gausswin`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`hamming`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`hann`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`idct`

C and C++ code generation for `idct` requires DSP System Toolbox software.

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.

`intfilt`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`kaiser`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`kaiserord`

`levinson`

C and C++ code generation for `levinson` requires DSP System Toolbox software.

If specified, the order of recursion must be a constant. Expressions or variables are allowed if their values do not change.

`maxflat`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`nuttallwin`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`parzenwin`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`peak2peak`

`peak2rms`

`pow2db`

`rcosdesign`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`rectwin`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`resample`

C and C++ code generation for `resample` requires DSP System Toolbox software.

The upsampling and downsampling factors must be specified as constants. Expressions or variables are allowed if their values do not change.

`rms`

`sgolay`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`sosfilt`

`taylorwin`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`triang`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`tukeywin`

All inputs must be constant. Expressions or variables are allowed if their values do not change.

`upfirdn`

C and C++ code generation for `upfirdn` requires DSP System Toolbox software.

Filter coefficients, upsampling factor, and downsampling factor must be constants. Expressions or variables are allowed if their values do not change.

Variable-size inputs are not supported.

`upsample`

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)`

`xcorr`

Leading ones in `size(x)` must be constant for every input `x`. If `x` is variable-size and is a row vector, it must be 1-by-`:`. It cannot be `:`-by-`:` with `size(x,1)` = 1 at run time.

`yulewalk`

If specified, the order of recursion must be a constant. Expressions or variables are allowed if their values do not change.

### Special Values in MATLAB

Function

Remarks and Limitations

`eps`

• Supported for scalar fixed-point signals only.

• Supported for scalar, vector, and matrix, `fi` single and `fi` double signals.

`inf`

• Dimensions must be real, nonnegative, integers.

`intmax`

`intmin`

NaN or `nan`

• Dimensions must be real, nonnegative, integers.

`pi`

`realmax`

`realmin`

### Specialized Math in MATLAB

Function

Remarks and Limitations

`airy`

Always returns a complex result.

`besseli`

• If the order `nu` is less than `0`, it must be an integer.

• Always returns a complex result.

`besselj`

• If the order `nu` is less than `0`, it must be an integer.

• Always returns a complex result.

`beta`

`betainc`

Always returns a complex result.

`betaincinv`

Always returns a complex result.

`betaln`

`ellipke`

`erf`

`erfc`

`erfcinv`

`erfcx`

`erfinv`

`expint`

`gamma`

`gammainc`

Output is always complex.

`gammaincinv`

Output is always complex.

`gammaln`

`psi`

### Statistics in MATLAB

Function

Remarks and Limitations

`corrcoef`

• Row-vector input is only supported when the first two inputs are vectors and nonscalar.

`cummin`

`cummax`

`mean`

`median`

`mode`

`std`

`var`

### Statistics and Machine Learning Toolbox

C and C++ code generation for the following functions requires the Statistics and Machine Learning Toolbox™ software.

Function

Remarks and Limitations

Descriptive Statistics and Visualization
`geomean`
`harmmean`
`iqr`
`kurtosis`

`mad`

Input `dim` cannot be empty.

`moment`

If `order` is nonintegral and `X` is real, use `moment(complex(X), order)`.

`nancov`

If the input is variable-size and is `[]` at run time, returns `[]` not `NaN`.

`nanmax`

`nanmean`

`nanmedian`

`nanmin`

`nanstd`

`nansum`

`nanvar`

`prctile`

• Automatic dimension restriction

• If the output `Y` is a vector, the orientation of `Y` differs from MATLAB when all of the following are true:

• You do not supply the `dim` input.

• `X` is a variable-size array.

• `X` is not a variable-length vector.

• `X` is a vector at run time.

• The orientation of the vector `X` does not match the orientation of the vector `p`.

In this case, the output `Y` matches the orientation of `X` not the orientation of `p`.

`quantile`

`skewness`

`zscore`

Probability Distributions

`betacdf`

`betafit`

`betainv`

`betalike`

`betapdf`

`betarnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`betastat`

`binocdf`

`binoinv`

`binopdf`

`binornd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`binostat`

`cdf`

`chi2cdf`

`chi2inv`

`chi2pdf`

`chi2rnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`chi2stat`

`evcdf`

`evinv`

`evpdf`

`evrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`evstat`

`expcdf`

`expinv`

`exppdf`

`exprnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`expstat`

`fcdf`

`finv`

`fpdf`

`frnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`fstat`

`gamcdf`

`gaminv`

`gampdf`

`gamrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`gamstat`

`geocdf`

`geoinv`

`geopdf`

`geornd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`geostat`

`gevcdf`

`gevinv`

`gevpdf`

`gevrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`gevstat`

`gpcdf`

`gpinv`

`gppdf`

`gprnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`gpstat`

`hygecdf`

`hygeinv`

`hygepdf`

`hygernd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`hygestat`

`icdf`

`logncdf`

`logninv`

`lognpdf`

`lognrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`lognstat`

`nbincdf`

`nbininv`

`nbinpdf`

`nbinrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`nbinstat`

`ncfcdf`

`ncfinv`

`ncfpdf`

`ncfrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`ncfstat`

`nctcdf`

`nctinv`

`nctpdf`

`nctrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`nctstat`

`ncx2cdf`

`ncx2rnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`ncx2stat`

`normcdf`

`norminv`

`normpdf`

`normrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`normstat`

`pdf`

`pearsrnd`

Matches MATLAB only when generated output `r` is scalar.

`poisscdf`

`poissinv`

`poisspdf`

`poissrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`poisstat`

`randg`

`random`

`randsample`

When sampling without replacement, the order of the output values might not match MATLAB.

`raylcdf`

`raylinv`

`raylpdf`

`raylrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`raylstat`

`tcdf`

`tinv`

`tpdf`

`trnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`tstat`

`unidcdf`

`unidinv`

`unidpdf`

`unidrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`unidstat`

`unifcdf`

`unifinv`

`unifpdf`

`unifrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`unifstat`

`wblcdf`

`wblinv`

`wblpdf`

`wblrnd`

Can return a different sequence of numbers than MATLAB if either of the following is true:

• The output is nonscalar.

• An input parameter is invalid for the distribution.

`wblstat`

Cluster Analysis

`kmeans`

• If the `Start` method uses random selections, the initial centroid cluster positions might not match MATLAB.

• If the number of rows in `X` is fixed, does not remove rows of `X` that contain a `NaN`.

• The cluster centroid locations in `C` can have a different order than in MATLAB. In this case, the cluster indices in `idx` have corresponding differences.

• If you provide `Display`, its value must be `'off'`.

• If you provide `Streams`, it must be empty and `UseSubstreams` must be `false`.

• When you set the `UseParallel` option to `true`, some computations can execute in parallel even when `Replicates` is `1`. For large data sets, when `Replicates` is `1`, consider setting the `UseParallel` option to `true`.

Classification
`loadCompactModel`Supports these classification model objects saved to a file using `saveCompactModel`.
For limitations on particular classification models, see the row corresponding to the model object in this table.
`ClassificationECOC` or `CompactClassificationECOC`When you train one of these models using `fitcecoc` or Classification Learner:
• The predictor variables in the input argument `Tbl` cannot be sparse. The predictor data input argument value `X` must be a full, numeric matrix.

• The class labels input argument value (`Y`) cannot be a categorical array.

• The `ClassNames` name-value pair argument cannot be a categorical array.

• You cannot use the `CategoricalPredictors` name-value pair argument or supply a table containing at least one categorical predictor. That is, code generation does not support categorical predictors. To dummy-code variables that you want treated as categorical, use `dummyvar`.

• All binary learners must be support vector machines or logistic-regression, linear classification models. That is, for the `Learners` name-value pair argument, you can specify

• `'svm'`

• An SVM template object or a cell vector of such objects (see `templateSVM`).

• A linear classification model template object or a cell vector of such objects (see `templateLinear`).

• For limitations on `ClassificationSVM` or `ClassificationLinear` model objects, see their entries in this table.

• You cannot specify to fit posterior probabilities by using the `FitPosterior` name-value pair argument.

`ClassificationLinear`When you train one of these models using `fitclinear`:
• The predictor data input argument value `X` must be a full, numeric matrix.

• The class labels input argument value (`Y`) cannot be a categorical array.

• The `ClassNames` name-value pair argument cannot be a categorical array.

• Logistic regression learners are supported only. That is, you can specify `'logistic'` only for the `Learner` name-value pair argument.

• You can specify one regularization strength only. That is, you can specify `'auto'` or a nonnegative scalar only for the `Lambda` name-value pair argument.

• You cannot specify a score transformation function by using the `ScoreTransform` name-value pair argument or by assigning the `ScoreTransform` object property.

`ClassificationSVM` or `CompactClassificationSVM`When you train one of these models using `fitcsvm` or Classification Learner:
• The class labels input argument value (`Y`) cannot be a categorical array.

• The `ClassNames` name-value pair argument cannot be a categorical array.

• You cannot use the `CategoricalPredictors` name-value pair argument or supply a table containing at least one categorical predictor. That is, code generation does not support categorical predictors. To dummy-code variables that you want treated as categorical, use `dummyvar`.

• MATLAB does not support one-class learning.

• You cannot specify a score transformation function by using the `ScoreTransform` name-value pair argument or by assigning the `ScoreTransform` object property. Consequently, `saveCompactModel` cannot accept compact SVM models equipped to estimate class posterior probabilities, that is, models returned by `fitPosterior` or `fitSVMPosterior`.

`predict` method of `ClassificationECOC` and `CompactClassificationECOC`
• You must call `predict` within a function that you declare (that is, you cannot call `predict` at the top-level).

• This table contains input-and-output-argument notes and limitations.

ArgumentNotes and Limitations
`Mdl`
`X`
• Must be a single- or double-precision matrix and can be variable sized. However, the number of columns in `X` must be `numel(Mdl.PredictorNames)`.

• Rows and columns must correspond to observations and predictors, respectively.

`BinaryLoss`Must be a supported binary loss function name, for example, `'linear'`
`NumKLInitializations`You cannot specify this name-value pair argument.
`Options`You cannot specify this name-value pair argument.
`PosteriorMethod`You cannot specify this name-value pair argument.
`Verbose`If you plan to generate a MEX file, then you can specify `Verbose`. Otherwise, `codegen` does not support `Verbose` for other file types.
`NegLoss`Returned as the same data type as `X`, that is, a single- or double-precision matrix
`Posterior`You cannot return this output argument.

`predict` method of `ClassificationLinear`
• You must call `predict` within a function that you declare (that is, you cannot call `predict` at the top-level).

• This table contains input-and-output-argument notes and limitations.

ArgumentNotes and Limitations
`Mdl`
`X`
• Must be a single- or double-precision matrix and can be variable sized. However, the number of columns in `X` must be `numel(Mdl.PredictorNames)`.

• Rows and columns must correspond to observations and predictors, respectively.

`Score`Returned as the same data type as `X`, that is, a single- or double-precision matrix

`predict` method of `ClassificationSVM` and `CompactClassificationSVM`
• You must call `predict` within a function that you declare (that is, you cannot call `predict` at the top-level).

• This table contains input-and-output-argument notes and limitations.

ArgumentNotes and Limitations
`SVMModel`
`X`
• Must be a single- or double-precision matrix and can be variable sized. However, the number of columns in `X` must be `numel(Mdl.PredictorNames)`.

• Rows and columns must correspond to observations and predictors, respectively.

`score`Returned as the same data type as `X`, that is, a single- or double-precision matrix

Dimensionality Reduction

`pca`

• Ignores the `'Display'` value for `'Options'` when `'Algorithm'` is `'als'`.

• If supplied, `'Weights'` and `'VariableWeights'` must be real.

• Always returns the fifth output `explained` as a column vector.

• Always returns the sixth output `mu` as a row vector.

• If `mu` is empty, `pca` returns `mu` as a 1-by-0 array. `pca` does not convert `mu` to a 0-by-0 empty array.

• Does not treat an input matrix `X` that has all NaN values as a special case. The outputs have the sizes that they have when some of the inputs are finite.

### System Identification Toolbox

C and C++ code generation for the following functions and System objects requires the System Identification Toolbox™ software.

NameRemarks and Limitations

`extendedKalmanFilter`

For more information, see Generate Code for Online State Estimation in MATLAB.

Supports MATLAB Function block: No

`recursiveAR`

Supports MATLAB Function block: No

`recursiveARMA`

Supports MATLAB Function block: No

`recursiveARMAX`

Supports MATLAB Function block: No

`recursiveARX`

Supports MATLAB Function block: No

`recursiveBJ`

Supports MATLAB Function block: No

`recursiveLS`

Supports MATLAB Function block: No

`recursiveOE`

Supports MATLAB Function block: No

For more information, see Generate Code for Online State Estimation in MATLAB.

Supports MATLAB Function block: No

### Trigonometry in MATLAB

Function

Remarks and Limitations

`acos`

When the input value `x` is real, but the output should be complex, generates an error during simulation and returns `NaN` in generated code. To get the complex result, make the input value complex by passing in `complex(x)`.

`acosd`

`acosh`

• Generates an error during simulation and returns `NaN` in generated code when the input value `x` is real, but the output should be complex. To get the complex result, make the input value complex by passing in `complex(x)`.

`acot`

`acotd`

`acoth`

`acsc`

`acscd`

`acsch`

`asec`

`asecd`

`asech`

`asin`

• Generates an error during simulation and returns `NaN` in generated code when the input value `x` is real, but the output should be complex. To get the complex result, make the input value complex by passing in `complex(x)`.

`asind`

`asinh`

`atan`

`atan2`

`atan2d`

`atand`

`atanh`

Generates an error during simulation and returns `NaN` in generated code when the input value `x` is real, but the output should be complex. To get the complex result, make the input value complex by passing in `complex(x)`.

`cos`

`cosd`

`cosh`

`cot`

`cotd`

• In some cases, returns `-Inf` when MATLAB returns `Inf`.

• In some cases, returns `Inf` when MATLAB returns `-Inf`.

`coth`

`csc`

`cscd`

• In some cases, returns `-Inf` when MATLAB returns `Inf`.

• In some cases, returns `Inf` when MATLAB returns `-Inf`.

`csch`

`deg2rad`

`hypot`

`rad2deg`

`sec`

`secd`

• In some cases, returns `-Inf` when MATLAB returns `Inf`.

• In some cases, returns `Inf` when MATLAB returns `-Inf`.

`sech`

`sin`

`sind`

`sinh`

`tan`

`tand`

• In some cases, returns `-Inf` when MATLAB returns `Inf`.

• In some cases, returns `Inf` when MATLAB returns `-Inf`.

`tanh`

### Wavelet Toolbox

C and C++ code generation for the following functions requires the Wavelet Toolbox™ software.

NameRemarks and Limitations
Signal Analysis

`appcoef`

Variable-size data support must be enabled.

Supports MATLAB Function block: No

`detcoef`

Supports MATLAB Function block: No

`dwt`

Supports MATLAB Function block: No

`dyadup`

• If `X` is empty, generated code returns `X` and MATLAB returns `[]`.

• Suppose that all of the following conditions are true:

• `X` is a variable-size array.

• `X` is not a variable-length column vector (:-by-1).

• `X` is a column vector at run time.

• `'type'` is not supplied.

In generated code, the output for `y = dyadup(X,k)`, where `k` is optional, matches the output for ```y = dyadup(X,k,'c')```. In MATLAB, the output for ```y = dyadup(X,k)``` matches the output for `y = dyadup(X,k,'r')`.

For code generation, when you do not specify `'type'`, if you want `dyadup` to treat `X` as a column vector, `X` must be a variable-length vector (:-by-1).

Supports MATLAB Function block: No

`idwt`

Supports MATLAB Function block: No

`imodwpt`

Supports MATLAB Function block: No

`imodwt`

Supports MATLAB Function block: No

`modwpt`

Supports MATLAB Function block: No

`modwptdetails`

Supports MATLAB Function block: No

`modwt`

Supports MATLAB Function block: No

`modwtmra`

Supports MATLAB Function block: No

`wavedec`

• Variable-size data support must be enabled.

• The input `'wname'` must be constant.

Supports MATLAB Function block: No

`waverec`

Variable-size data support must be enabled.

Supports MATLAB Function block: No

`wextend`

The generated code can return a column vector when MATLAB returns a row vector if all of the following conditions are true:

• `TYPE` specifies a 1–D extension.

• Input `X` is a variable-size vector.

• Input `X` is not a variable-length row vector (1-by-:).

Code generation does not produce a warning or error message about the shape mismatch. In the output vector that the generated code returns, the values match the values in the output vector that MATLAB returns.

In this case, to generate code that returns a row vector, pass `X(:).'` instead of `X`.

Supports MATLAB Function block: No

Image Analysis

`appcoef2`

Variable-size data support must be enabled.

Supports MATLAB Function block: No

`detcoef2`

Supports MATLAB Function block: No

`dwt2`

Supports MATLAB Function block: No

`idwt2`

Variable-size data support must be enabled.

Supports MATLAB Function block: No

`wavedec2`

• Variable-size data support must be enabled.

• The input `'wname'` must be constant.

Supports MATLAB Function block: No

`waverec2`

Variable-size data support must be enabled.

Supports MATLAB Function block: No

Denoising

`ddencmp`

Variable-size data support must be enabled.

Supports MATLAB Function block: No

`thselect`

Supports MATLAB Function block: No

`wden`

Variable-size data support must be enabled.

Supports MATLAB Function block: No

`wdencmp`

Variable-size data support must be enabled.

Supports MATLAB Function block: No

`wnoisest`

Supports MATLAB Function block: No

`wthcoef`

Supports MATLAB Function block: No

`wthcoef2`

Supports MATLAB Function block: No

`wthresh`

Supports MATLAB Function block: No

Orthogonal and Biorthogonal Filter Banks

`qmf`

Supports MATLAB Function block: No

### WLAN System Toolbox

C and C++ code generation for the following functions and System objects requires the WLAN System Toolbox™ software.

 Note:   WLAN System Toolbox functionality with the MATLAB Function block is not supported.

Get trial now