# Documentation

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

You can generate efficient C and 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 and 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 generation software 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 generation software 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`

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

`class`

`double`

No integer overflow detection for `int64` in MEX or MATLAB Function block simulation on Windows® 32-bit platforms.

`logical`

`single`

`typecast`

• Value of string input argument `type` 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.

No integer overflow detection for `int64` in MEX or MATLAB Function block simulation on Windows 32-bit platforms.

### Complex Numbers in MATLAB

Function

Remarks and Limitations

`complex`

`conj`

`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.mvisionRecovertformCodeGeneration_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.mvisionRecovertformCodeGeneration_kernel.m, which is used in the Introduction to Code Generation with Feature Matching and Registration example.
`detectBRISKFeatures`Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
`detectFASTFeatures`Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared 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
Generated code for this function uses a precompiled platform-specific shared 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
Generated code for this function uses a precompiled platform-specific shared library.
`extractFeatures`Generates platform-dependent library: Yes for `BRISK`, `FREAK`, and `SURF` methods only.
Compile-time constant input restrictions: `'Method'`
Supports MATLAB Function block: Yes for `Block` method only.
Generated code for this function uses a precompiled platform-specific shared library.
`extractHOGFeatures`Supports MATLAB Function block: No
`matchFeatures`Generates platform-dependent library: Yes for MATLAB host.
Generates portable C code for non-host target.
Compile-time constant input: `'Method‘` and `'Metric'`.
Supports MATLAB Function block: Yes
`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.mvisionRecovertformCodeGeneration_kernel.m, which is used in the Introduction to Code Generation with Feature Matching and Registration example.
`vision.BoundaryTracer`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.EdgeDetector`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
Image Registration and Geometric Transformations
`estimateGeometricTransform`Supports MATLAB Function block: No
`vision.GeometricRotator`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.GeometricScaler`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.GeometricShearer`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.GeometricTransformer`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.GeometricTranslator`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
Generated code for this function uses a precompiled platform-specific shared library.
System Objects in MATLAB Code Generation
`vision.CascadeObjectDetector`Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
System Objects in MATLAB Code Generation
Tracking and Motion Estimation
`assignDetectionsToTracks`Supports MATLAB Function block: Yes
`opticalFlowHS`Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
`opticalFlowLKDoG`Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
`opticalFlowLK`Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
`opticalFlow`Supports MATLAB Function block: Yes
`vision.BlockMatcher`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.ForegroundDetector`Supports MATLAB Function block: No
Generates platform-dependent library: Yes for MATLAB host.
Generates portable C code for non-host target.
Generated code for this function uses a precompiled platform-specific shared library.
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
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
`disparity`Compile-time constant input restriction: `'Method'`.
Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
`cameraMatrix`Supports MATLAB Function block: No
`cameraParameters`Supports MATLAB Function block: No
`epipolarline`Supports MATLAB Function block: Yes
`estimateFundamentalMatrix`Compile-time constant input restriction: `'Method'`, `'OutputClass'`, `'DistanceType'`, and `'ReportRuntimeError'`.
Supports MATLAB Function block: Yes
`estimateUncalibratedRectification`Supports MATLAB Function block: Yes
Only accepts input points as M-by-2 matrices for C code generation
`extrinsics`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
`selectStrongestBbox`Supports MATLAB Function block: No
`stereoParameters`Supports MATLAB Function block: No
`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.Histogram`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.PSNR`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
Morphological Operations
`vision.ConnectedComponentLabeler`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.MorphologicalBottomHat`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.MorphologicalClose`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.MorphologicalDilate`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.MorphologicalErode`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.MorphologicalOpen`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.MorphologicalTopHat`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.ContrastAdjuster`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.EdgeDetector`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.HistogramEqualizer`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.HoughTransform`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.ImageFilter`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
Video Loading, Saving, and Streaming
`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.Autothresholder`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.ChromaResampler`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.ColorSpaceConverter`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
`vision.ImageComplementer`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.ImageDataTypeConverter`Supports MATLAB Function block: Yes
System Objects in MATLAB Code Generation
`vision.ImagePadder`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
`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
`vision.TextInserter`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 generation software generates C `if` statements in place of a C `switch` statement.

`while`

### Data and File Management in MATLAB

Function

Remarks and Limitations

`computer`

• Information about the computer on which the code generation software 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')`

• 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 string. 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`

`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 strings.

• Does not support loading objects.

• 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 generation software 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

`deal`

`iscell`

`isobject`

`nargchk`

• Output structure does not include stack information.

 Note:   `nargchk` will be removed in a future release.

`narginchk`

`nargoutchk`

`str2func`

• String must be constant/known at compile time

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

System Objects in MATLAB Code Generation

`dsp.CepstralToLPC`

System Objects in MATLAB Code Generation

`dsp.CrossSpectrumEstimator`

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`

System Objects in MATLAB Code Generation

`dsp.TransferFunctionEstimator`

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.AllpoleFilter`

`dsp.BiquadFilter`

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

System Objects in MATLAB Code Generation

`dsp.HighpassFilter`

System Objects in MATLAB Code Generation

`dsp.IIRFilter`

`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.RLSFilter`

System Objects in MATLAB Code Generation

`dsp.SampleRateConverter`

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.

`iirparameq`

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

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.SpectrumAnalyzer`

This System object™ does not generate code. It is automatically declared as an extrinsic variable using the `coder.extrinsic` function.

`dsp.TimeScope`

This System object does not generate code. It is automatically declared as an extrinsic variable using the `coder.extrinsic` function.

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

`dsp.AudioPlayer`

System Objects in MATLAB Code Generation

`dsp.AudioFileWriter`

System Objects in MATLAB Code Generation

`dsp.UDPSender`

System Objects in MATLAB Code Generation

Sources

`dsp.AudioFileReader`

System Objects in MATLAB Code Generation

`dsp.AudioRecorder`

System Objects in MATLAB Code Generation

`dsp.SignalSource`

System Objects in MATLAB Code Generation

`dsp.SineWave`

`dsp.UDPReceiver`

System Objects in MATLAB Code Generation

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.Minimum`

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`

System Objects in MATLAB Code Generation

`dsp.IDCT`

System Objects in MATLAB Code Generation

`dsp.IFFT`

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.

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

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

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

`bweuler`

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

`bwlabel`

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

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

`bwmorph`

The text string 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.

`bwpack`

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

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

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

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

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

`conndef`

Input arguments must be compile-time constants.

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

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

`fspecial`

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

`getrangefromclass`
`histeq`

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

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

`im2uint8`

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

`im2uint16`

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

`im2int16`

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

`im2single`
`im2double`
`imadjust`

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

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

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

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

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

`imcomplement`

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

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

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

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

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

`imfill`

The optional input connectivity, `conn` and the string `'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.

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

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

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

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

`imlincomb`

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

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

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

`imquantize`

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

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

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

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

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

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

`imwarp`

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

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

`intlut`

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

`iptcheckconn`

Input arguments must be compile-time constants.

`iptcheckmap`

`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 string 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'`.

`mean2`
`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.

`multithresh`

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

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

`padarray`

Support only up to 3-D inputs.

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

`projective2d`

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

`regionprops`

Supports only 2-D images. Does not accept the connected component structure (CC) returned by `bwconncomp`. Use `bwlabel` to create a label matrix, or pass the image to `regionprops` directly. 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.

`rgb2gray`
`rgb2ycbcr`
`strel`Input arguments must be compile-time constants. The following methods are not supported for code generation: `getsequence`, `reflect`, `translate`, `disp`, `display`, `loadobj`. When generating code, you can only specify single objects—arrays of objects are not supported.
`stretchlim`

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

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

`ycbcr2rgb`

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

`interp1`

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.

`meshgrid`

`mkpp`

• The output structure `pp` differs from the `pp` structure in MATLAB. In MATLAB, `ppval` cannot use the `pp` structure from the code generation software. 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 generation software:

• 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 generation software:

• 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 generation software 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 generation software:

• 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 generation software.

• 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 `message` string 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`

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

• For code generation,`QZ` algorithm is used in all cases. MATLAB can use different algorithms for different inputs. Consequently, `V` might represent a different basis of eigenvectors. The eigenvalues in `D` might not be in the same order as in MATLAB.

• With one input, `[V,D] = eig(A)`, the results are similar to those obtained using `[V,D] = eig(A,eye(size(A)),'qz')` in MATLAB, except that for code generation, 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)`.

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

`flipdim`

 Note:   `flipdim` will be removed in a future release. Use `flip` instead.

`fliplr`

`flipud`

`full`

`hadamard`

`hankel`

`hilb`

`ind2sub`

`inv`

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

`invhilb`

`ipermute`

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`iscolumn`

`isempty`

`isequal`

`isequaln`

`isfinite`

`isfloat`

`isinf`

`isinteger`

`islogical`

`ismatrix`

`isnan`

`isrow`

`issparse`

`isvector`

`kron`

`length`

`linspace`

`logspace`

`lu`

`magic`

`max`

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

• Does not support the `nanflag` argument.

`min`

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

• Does not support the `nanflag` argument.

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

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`pinv`

`planerot`

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

`prod`

`qr`

`rand`

`randi`

• `classname` 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)`.

`randn`

`randperm`

`rank`

`rcond`

`repmat`

`reshape`

`rng`

• For library code generation targets, executable code generation targets, and MEX targets with extrinsic calls disabled:

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

• For the `generator` input, supports `'twister'`, `'v4'`, and `'v5normal'`.

For these targets, the output of `s=rng` in the generated code differs from the MATLAB output. You cannot return the output of `s=rng` from the generated code and pass it to `rng` in MATLAB.

• For MEX targets, if extrinsic calls are enabled, you cannot access the data in the structure returned by `rng`.

`rosser`

`rot90`

`shiftdim`

`sign`

`size`

`sort`

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`

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`

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

`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 Neural Network Functions.

### Nonlinear Numerical Methods in MATLAB

Function

Remarks and Limitations

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

### 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.

`trapz`

### Optimization Functions in MATLAB

Function

Remarks and Limitations

`fminsearch`

• Ignores the `Display` option. Does not print status information during execution. Test the `exitflag` output 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, inline function, or string 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 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.

Signal Radiation and Collection
`phased.Collector`See System Objects in MATLAB Code Generation.
`phased.Radiator` See System Objects in MATLAB Code Generation.
`phased.WidebandCollector`

`sensorsig`

Does not support variable-size inputs.

Waveforms

`ambgfun`

Does not support variable-size inputs.

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

Transmitters and Receivers

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

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.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.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.

`mdltest`

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.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.

Space-Time Adaptive Processing (STAP)

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

Signal Propagation and Environment

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

`grazingang`

Does not support variable-size inputs.

`horizonrange`

Does not support variable-size inputs.

`phased.BarrageJammer`See System Objects in MATLAB Code Generation.
`phased.ConstantGammaClutter`See System Objects in MATLAB Code Generation.
`phased.FreeSpace`
`phased.RadarTarget`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.

Detection and System Analysis

`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`See System Objects in MATLAB Code Generation.
`phased.MatchedFilter`
• The `CustomSpectrumWindow` property is not supported.

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

`phased.StretchProcessor`See System Objects in MATLAB Code Generation.
`phased.TimeVaryingGain`See System Objects in MATLAB Code Generation.

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

`range2beat`

Does not support variable-size inputs.

`rdcoupling`

Does not support variable-size inputs.

`rocpfa`

• Does not support variable-size inputs.

• The `NonfluctuatingNoncoherent` signal type is not supported.

`rocsnr`

• Does not support variable-size inputs.

• The `NonfluctuatingNoncoherent` signal type is not supported.

`shnidman`

Does not support variable-size inputs.

`stretchfreq2rng`

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

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

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

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

• The second input, `B`, must be sorted in ascending order.

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

`issorted`

`setdiff`

• 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 `'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))`.

`setxor`

• 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 `'sorted'` 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`

• 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 `'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))`.

`unique`

• 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 `'sorted'` 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`

• Length of input matrix dimensions must each be a power of 2.

`fftn`

• Length of input matrix dimensions must each be a power of 2.

`fftshift`

`filter`

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

• v

`freqspace`

`ifft`

`ifft2`

• Length of input matrix dimensions must each be a power of 2.

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

`ifftn`

• Length of input matrix dimensions must each be a power of 2.

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

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

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

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.

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

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

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

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

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

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

• Does not support the `nanflag` argument.

`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

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

`geomean`

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

`harmmean`

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

`iqr`

`kurtosis`

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

`mad`

Input `dim` cannot be empty.

`mnpdf`

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`

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

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

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

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

`randg`

`random`

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

`skewness`

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

`zscore`

### String Functions in MATLAB

Function

Remarks and Limitations

`bin2dec`

• Does not match MATLAB when the input is empty.

`blanks`

`char`

`deblank`

• Supports only inputs from the `char` class.

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

`hex2num`

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

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

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

`num2hex`

`str2double`

• Does not support cell arrays.

• Always returns a complex result.

`strcmp`

`strcmpi`

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

`strfind`
• Does not support cell arrays.

• If `pattern` does not exist in `str`, returns `zeros(1,0)` not []. To check for an empty return, use `isempty`.

• Inputs must be character row vectors.

`strjust`

`strncmp`

`strncmpi`

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

`strrep`

• Does not support cell arrays.

• If `oldSubstr` does not exist in `origStr`, returns `blanks(0)`. To check for an empty return, use `isempty`.

• Inputs must be character row vectors.

`strtok`

`strtrim`

• Supports only inputs from the `char` class.

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

`upper`

• Supports only `char` inputs.

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

### Structures in MATLAB

Function

Remarks and Limitations

`isfield`

• Does not support cell input for second argument

`isstruct`

`struct`

### Trigonometry in MATLAB

Function

Remarks and Limitations

`acos`

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

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

`hypot`

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

Was this topic helpful?

Get trial now