Documentation 
You can generate efficient C and C++ code for a subset of MATLAB^{®} builtin 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 fixedpoint algorithms, refer to Code Acceleration and Code Generation from MATLAB. 
C and C++ code generation for the following Aerospace Toolbox quaternion functions requires the Aerospace Blockset™ software.
Function  Remarks and Limitations 

—  
—  
—  
—  
—  
—  
— 
See Array vs. Matrix Operations for detailed descriptions of the following operator equivalent functions.
Function  Remarks and Limitations 

ctranspose  — 
 
—  
—  
—  
—  
—  
—  
 
—  
 
—  
Multiplication of pure imaginary numbers by nonfinite 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.  
—  
—  
— 
Function  Remarks and Limitations 

—  
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 nondouble inputs, the input port data types must be specified, not inherited. 
Function  Remarks and Limitations 

—  
—  
—  
—  
No integer overflow detection for int64 in MEX or MATLAB Function block simulation on Windows^{®} 32bit platforms.  
—  
—  
 
No integer overflow detection for int64 in MEX or MATLAB Function block simulation on Windows 32bit platforms. 
C and C++ code generation for the following functions and System objects requires the Communications System Toolbox™ software.
Function  Remarks and Limitations 

—  
—  
—  
—  
—  
—  
—  

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

Feature Detection, Extraction, and Matching  
BRISKPoints  Compiletime constant inputs: No
restriction 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  Compiletime constant input: No
restriction 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 platformspecific shared library. 
detectFASTFeatures  Supports MATLAB Function block: No Generated code for this function uses a precompiled platformspecific shared library. 
detectHarrisFeatures  Compiletime constant input: FilterSize Supports MATLAB Function block: No Generated code for this function uses a precompiled platformspecific shared library. 
detectMinEigenFeatures  Compiletime constant input: FilterSize Supports MATLAB Function block: No Generated code for this function uses a precompiled platformspecific shared library. 
detectMSERFeatures  Compiletime constant input: No
restriction Supports MATLAB Function block: No Generated code for this function uses a precompiled platformspecific shared library. For code generation, the function outputs regions.PixelList as an array. The region sizes are defined in regions.Lengths. 
detectSURFFeatures  Compiletime constant input: No
restrictions Supports MATLAB Function block: No Generated code for this function uses a precompiled platformspecific shared library. 
extractFeatures  Generates platformdependent library: Yes for BRISK, FREAK,
and SURF methods only. Compiletime constant input: Method Supports MATLAB Function block: Yes for Block method only. Generated code for this function uses a precompiled platformspecific shared library. 
extractHOGFeatures  Compiletime constant input: No Supports MATLAB Function block: No 
matchFeatures  Generates platformdependent library: Yes for MATLAB host. Generates portable C code for nonhost target. Compiletime constant input: Method and Metric. Supports MATLAB Function block: Yes 
MSERRegions  Compiletime constant input: No
restrictions. 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 platformspecific shared library. 
SURFPoints  Compiletime constant input: No
restrictions. 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  Compiletime constant input: transformType 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  Compiletime constant input: TextLayout, Language,
and CharacterSet. Supports MATLAB Function block: No Generated code for this function uses a precompiled platformspecific shared library. 
ocrText  Compiletime constant input: No
restrictions. Supports MATLAB Function block: No 
vision.PeopleDetector  Supports MATLAB Function block: No Generated code for this function uses a precompiled platformspecific shared library. System Objects in MATLAB Code Generation 
vision.CascadeObjectDetector  Supports MATLAB Function block: No Generated code for this function uses a precompiled platformspecific shared library. System Objects in MATLAB Code Generation 
Tracking and Motion Estimation  
assignDetectionsToTracks  Compiletime constant input: No
restriction. 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 platformdependent library: Yes for MATLAB host. Generates portable C code for nonhost target. Generated code for this function uses a precompiled platformspecific 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.OpticalFlow  Supports MATLAB Function block: Yes System Objects in MATLAB Code Generation 
vision.PointTracker  Supports MATLAB Function block: Yes 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  Compiletime constant input: No
restriction Supports MATLAB Function block: No 
disparity  Compiletime constant input: Method. Supports MATLAB Function block: No Generated code for this function uses a precompiled platformspecific shared library. 
epipolarline  Compiletime constant input: No
restrictions. Supports MATLAB Function block: Yes 
estimateFundamentalMatrix  Compiletime constant input: Method, OutputClass, DistanceType,
and ReportRuntimeError. Supports MATLAB Function block: Yes 
estimateUncalibratedRectification  Compiletime constant input: transformType Supports MATLAB Function block: No 
isEpipoleInImage  Compiletime constant input: No
restrictions. Supports MATLAB Function block: Yes 
lineToBorderPoints  Compiletime constant input: No
restrictions. Supports MATLAB Function block: Yes 
selectStrongestBbox  Compiletime constant input: No
restriction 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 Generates code on Linux^{®} and Windows platforms Generated code for this function uses a precompiled platformspecific shared library. System Objects in MATLAB Code Generation 
vision.VideoFileReader  Supports MATLAB Function block: Yes Generated code for this function uses a precompiled platformspecific shared library. System Objects in MATLAB Code Generation 
vision.VideoFileWriter  Supports MATLAB Function block: Yes Generated code for this function uses a precompiled platformspecific 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  Compiletime constant input: marker Supports MATLAB Function block: Yes 
insertShape  Compiletime constant input: shape 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 
Function  Remarks and Limitations 

—  
—  
—  
—  
—  
Treated as a forloop when used with fiaccel.  
—  
 
— 
Function  Remarks and Limitations 

 
—  
—  
 
 
 
—  

Function  Remarks and Limitations 

—  
—  
—  
 
—  
—  
 

Function  Remarks and Limitations 

 
 

Function  Remarks and Limitations 

 
—  
 
—  
 

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.
Name  Remarks and Limitations 

Estimation  
Filters  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
 
 
 
 
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
 
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
 
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
 
 
 
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
Math Operations  
dsp.UpperTriangularSolver  
Quantizers  
Scopes  
This System object™ does not generate code. It is automatically declared as an extrinsic variable using the coder.extrinsic function.  
This System object does not generate code. It is automatically declared as an extrinsic variable using the coder.extrinsic function.  
Signal Management  
Signal Operations  
 
Sinks  
Sources  
 
Statistics  
 
Transforms  
Function  Remarks and Limitations 

 
For standalone code generation, excluded from the generated code. 
Function  Remarks and Limitations 

—  
—  
—  
—  
 
—  
—  
—  
—  
—  
—  
—  
—  

Function  Remarks and Limitations 

—  
—  
—  
—  
 
—  
— 
In addition to functionspecific limitations listed in the table, the following general limitations apply to the use of FixedPoint 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.
Function  Remarks/Limitations 

N/A  
N/A  
N/A  
 
N/A  
N/A  
N/A  
Not supported for slopebias scaled fi objects.  
N/A  
N/A  
N/A  
N/A  
Not supported for slopebias scaled fi objects.  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
Generated code may not handle out of range shifting.  
Generated code may not handle out of range shifting.  
Generated code may not handle out of range shifting.  
Not supported for slopebias scaled fi objects.  
N/A  
N/A  
N/A  
N/A  
 
N/A  
Variablesize signals are not supported.  
Variablesize signals are not supported.  
Variablesize signals are not supported.  
Variablesize signals are not supported.  
Variablesize signals are not supported.  
Variablesize signals are not supported.  
Variablesize signals are not supported.  
Variablesize signals are not supported.  
Variablesize signals are not supported.  
Variablesize signals are not supported.  
N/A  
N/A  
If supplied, the index, k, must be a real and scalar integer value that is not a fi object.  
 
For the automated workflow, do not use explicit double or single casts in your MATLAB algorithm to insulate functions that do not support fixedpoint 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.  
N/A  
 
Not supported for fixedpoint signals with different biases.  
 
 
 
N/A  
N/A  
The dimensions argument must be a builtin type; it cannot be a fi object.  
N/A  
N/A  
N/A  
N/A  
Not supported for fixedpoint signals with different biases.  
The syntax structure = get(o) is not supported.  
N/A  
N/A  
Not supported for fixedpoint signals with different biases.  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
Avoid using the isfi function in code that you intend to convert using the automated workflow. The value returned by isfi in the fixedpoint code might differ from the value returned in the original MATLAB algorithm. The behavior of the fixedpoint code might differ from the behavior of the original algorithm.  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
Not supported for fixedpoint signals with different biases.  
N/A  
N/A  
N/A  
 
Not supported for fixedpoint signals with different biases.  
N/A  
N/A  
N/A  
N/A  
Any nonfi input must be constant; that is, its value must be known at compile time so that it can be cast to a fi object.  
 
 
N/A  
 
N/A  
Not supported for fixedpoint signals with different biases.  
N/A  
numberofelements will be removed in a future release. Use numel instead.  
N/A  
 
The dimensions argument must be a builtin type; it cannot be a fi object.  
Any nonfi inputs must be constant; that is, its value must be known at compile time so that it can be cast to a fi object.  
N/A  
When the exponent k is a variable, the ProductMode property of the governing fimath must be SpecifyPrecision.  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
N/A  
The dimensions argument must be a builtin type; it cannot be a fi object.  
N/A  
N/A  
In the syntax rot90(A,k), the argument k must be a builtin type; it cannot be a fi object.  
N/A  
N/A  
 
The dimensions argument must be a builtin type; it cannot be a fi object.  
N/A  
N/A  
For the automated workflow, do not use explicit double or single casts in your MATLAB algorithm to insulate functions that do not support fixedpoint 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.  
N/A  
The dimensions argument must be a builtin type; it cannot be a fi object.  
N/A  
 
N/A  
N/A  
 
N/A  
N/A  
Variablesized inputs are only supported when the SumMode property of the governing fimath is set to Specify precision or Keep LSB.  
 
N/A  
If supplied, the index, k, must be a real and scalar integer value that is not a fi object.  
If supplied, the index, k, must be a real and scalar integer value that is not a fi object.  
 
N/A  
N/A  
N/A  
N/A  
N/A 
Function  Remarks and Limitations 

 

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.
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 platformspecific 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.
Function  Remarks/Limitations 

affine2d  When generating code, you can only specify single objects—arrays of objects are not supported. 
bwdist  The method argument must be a compiletime
constant. Input images must have fewer than 2^{32} pixels. Generated code for this function uses a precompiled, platformspecific shared library. 
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, platformspecific shared library.  
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, platformspecific shared library.  
bwpack  Generated code for this function uses a precompiled platformspecific 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 compiletime constant. In addition, with code generation, bwselect only supports only the 1 and 2 output argument syntaxes: BW2 = bwselect(___) or [BW2, idx] = bwselect(___). Generated code for this function uses a precompiled platformspecific shared library. 
bwtraceboundary  The dir, fstep, and conn arguments must be compiletime constants. 
bwunpack  Generated code for this function uses a precompiled platformspecific shared library. 
Input arguments must be compiletime constants.  
edge  The method, direction, and sigma arguments must be a compiletime 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. Generated code for this function uses a precompiled platformspecific shared library. 
fitgeotrans  The transformtype argument must be a compiletime constant. The function supports the following transformation types: 'nonreflectivesimilarity', 'similarity', 'affine', or 'projective'. 
Inputs must be compiletime 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 platformspecific shared library. 
im2uint8  Generated code for this function uses a precompiled platformspecific shared library. 
im2uint16  Generated code for this function uses a precompiled platformspecific shared library. 
im2int16  Generated code for this function uses a precompiled platformspecific 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 platformspecific shared library. 
imbothat  The input image IM must be either 2D or 3D image. The structuring element input argument SE must be a compiletime constant. If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platformspecific shared library. 
imclearborder  The optional second input argument, conn,
must be a compiletime constant. Supports only up to 3D inputs. Generated code for this function uses a precompiled platformspecific shared library. 
imclose  The input image IM must be either 2D or 3D image. The structuring element input argument SE must be a compiletime constant. If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platformspecific shared library. 
Does not support int64 and uint64 data types.  
imdilate  The input image IM must be either 2D or 3D image. The SE, PACKOPT, and SHAPE input arguments must be a compiletime 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, platformspecific shared library. 
imerode  The input image IM must be either 2D or 3D image. The SE, PACKOPT, and SHAPE input arguments must be a compiletime 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, platformspecific shared library. 
imextendedmax  The optional third input argument, conn, must be a compiletime constant. Generated code for this function uses a precompiled platformspecific shared library. 
imextendedmin  The optional third input argument, conn, must be a compiletime constant. Generated code for this function uses a precompiled platformspecific shared library. 
The optional input connectivity, conn and the string 'holes' must be compiletime constants. Supports only up to 3D inputs. The interactive mode to select points, imfill(BW,0,CONN) is not supported in code generation. locations can be a Pby1 vector, in which case it contains the linear indices of the starting locations. locations can also be a Pbyndims(I) matrix, in which case each row contains the array indices of one of the starting locations. Once you select a format at compiletime, you cannot change it at run time. However, the number of points in locations can be varied at run time. Generated code for this function uses a precompiled platformspecific shared library.  
imfilter  The input image can be either 2D or 3D. The value of the input argument, options, must be a compiletime constant. If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platformspecific shared library. 
imhist  The optional second input argument, n, must be a compiletime constant. In addition, nonprogrammatic syntaxes are not supported. For example, the syntaxes where imhist displays the histogram are not supported. Generated code for this function uses a precompiled platformspecific shared library. 
The optional third input argument, conn, must be a compiletime constant Generated code for this function uses a precompiled platformspecific shared library.  
The optional third input argument, conn, must be a compiletime constant Generated code for this function uses a precompiled platformspecific shared library.  
imlincomb  The output_class argument must be a compiletime
constant. Generated code for this function uses a precompiled platformspecific shared library. 
imopen  The input image IM must be either 2D or 3D image. The structuring element input argument SE must be a compiletime constant. If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platformspecific shared library. 
imquantize  — 
The optional third input argument, conn, must be a compiletime constant. Generated code for this function uses a precompiled platformspecific 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. 
The optional second input argument, conn, must be a compiletime constant. Generated code for this function uses a precompiled platformspecific shared library.  
The optional second input argument, conn, must be a compiletime constant. Generated code for this function uses a precompiled platformspecific shared library.  
imtophat  The input image IM must be either 2D or 3D image. The structuring element input argument SE must be a compiletime constant. If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platformspecific 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. Generated code for this function uses a precompiled platformspecific shared library. 
intlut  Generated code for this function uses a precompiled platformspecific shared library. 
Input arguments must be compiletime constants.  
iptcheckmap  — 
Referring to the standard syntax: RGB = label2rgb(L, map, zerocolor, order)
 
mean2  — 
medfilt2  The padopt argument must be a compiletime
constant. Generated code for this function uses a precompiled platformspecific shared library. 
multithresh  — 
ordfilt2  The padopt argument must be a compiletime
constant. Generated code for this function uses a precompiled platformspecific shared library. 
padarray  Support only up to 3D inputs. Input arguments, padval and direction are expected to be compiletime constants. 
projective2d  When generating code, you can only specify single objects—arrays of objects are not supported. 
rgb2ycbcr  — 
strel  Input arguments must be compiletime 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  Generated code for this function uses a precompiled platformspecific shared library. 
ycbcr2rgb  — 
Function  Remarks and Limitations 

—  

Function  Remarks and Limitations 

—  
—  
VariableSizing Restrictions for Code Generation of Toolbox Functions  
 
 
—  
 
 
—  
—  
The size of output v does not match MATLAB when both of the following statements are true:
The code generation software does not remove the singleton dimensions. However, MATLAB might remove singleton dimensions. For example, suppose that x is a :4by: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 2by3 fixedsize array. v has size 2by3by:4by: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].  
—  
—  
 

Function  Remarks and Limitations 

—  
—  
 
 
 
—  
Can return a different Schur decomposition in generated code than in MATLAB.  
— 
C and C++ code generation for the following functions requires the MATLAB Compiler™ software.
Function  Remarks and Limitations 

 

Function  Remarks and Limitations 

—  
VariableSizing Restrictions for Code Generation of Toolbox Functions  
—  
VariableSizing Restrictions for Code Generation of Toolbox Functions  
—  
bsxfun  VariableSizing Restrictions for Code Generation of Toolbox Functions 
cat 

—  
 
compan  — 
cond  VariableSizing Restrictions for Code Generation of Toolbox Functions 
cov  VariableSizing Restrictions for Code Generation of Toolbox Functions 
 
 
 
—  
 
 
—  
 
classname must be a builtin 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).  
 
 
—  
—  
—  
—  
—  
—  
—  
 
Singular matrix inputs can produce nonfinite values that differ from MATLAB results.  
—  
VariableSizing Restrictions for Code Generation of Toolbox Functions  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
VariableSizing Restrictions for Code Generation of Toolbox Functions  
 
 
—  
—  
—  
—  
—  
—  
—  
 
—  
VariableSizing Restrictions for Code Generation of Toolbox Functions  
—  
VariableSizing Restrictions for Code Generation of Toolbox Functions  
 
—  
 
 
 
—  
—  
—  
—  
 
—  
—  
 
—  
—  
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.  
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.  
—  
 
—  
 
—  
—  
 
 
 
—  
—  

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 thegenSim function. See Deploy Neural Network Functions.
Function  Remarks and Limitations 

 
— 
Function  Remarks and Limitations 

—  
—  
 
—  
 
 
The name argument must be constant.  
All inputs must be constant.  

Function  Remarks and Limitations 

 
 
Input parameter names must be constant.  

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

Antenna and Microphone Elements  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
phased.CosineAntennaElement 

phased.CrossedDipoleAntennaElement 

phased.CustomAntennaElement 

phased.CustomMicrophoneElement 

phased.IsotropicAntennaElement 

phased.OmnidirectionalMicrophoneElement 

phased.ShortDipoleAntennaElement 

Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
 
 
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Array Geometries and Analysis  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
phased.ArrayGain 

phased.ArrayResponse  Code Generation. 
phased.ConformalArray 

phased.ElementDelay  Code Generation. 
phased.PartitionedArray 

phased.ReplicatedSubarray 

phased.SteeringVector  See Code Generation. 
phased.ULA 

phased.URA 

Signal Radiation and Collection  
phased.Collector  Code Generation. 
phased.Radiator  Code Generation. 
phased.WidebandCollector 

Does not support variablesize inputs.  
Waveforms  
Does not support variablesize inputs.  
phased.FMCWWaveform  Code Generation. 
phased.LinearFMWaveform  Code Generation. 
phased.PhaseCodedWaveform  Code Generation. 
phased.RectangularWaveform  Code Generation. 
phased.SteppedFMWaveform  Code Generation. 
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Transmitters and Receivers  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
phased.ReceiverPreamp  Code Generation. 
phased.Transmitter  Code Generation. 
Does not support variablesize inputs.  
Beamforming  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
phased.FrostBeamformer 

phased.LCMVBeamformer  Code Generation. 
phased.MVDRBeamformer  Code Generation. 
phased.PhaseShiftBeamformer  Code Generation. 
phased.SteeringVector  Code Generation. 
phased.SubbandPhaseShiftBeamformer  Code Generation. 
phased.TimeDelayBeamformer 

phased.TimeDelayLCMVBeamformer 

Does not support variablesize inputs.  
Does not support variablesize inputs.  
Direction of Arrival (DOA) Estimation  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
phased.BeamscanEstimator  Code Generation. 
phased.BeamscanEstimator2D  Code Generation. 
phased.BeamspaceESPRITEstimator  Code Generation. 
phased.ESPRITEstimator  Code Generation. 
phased.MVDREstimator  Code Generation. 
phased.MVDREstimator2D  Code Generation. 
phased.RootMUSICEstimator  Code Generation. 
phased.RootWSFEstimator  Code Generation. 
phased.SumDifferenceMonopulseTracker  Code Generation. 
phased.SumDifferenceMonopulseTracker2D  Code Generation. 
Does not support variablesize inputs.  
Does not support variablesize inputs.  
SpaceTime Adaptive Processing (STAP)  
Does not support variablesize inputs.  
phased.ADPCACanceller  Code Generation. 
phased.AngleDopplerResponse  Code Generation. 
phased.DPCACanceller  Code Generation. 
phased.STAPSMIBeamformer  Code Generation. 
Does not support variablesize inputs.  
Signal Propagation and Environment  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
phased.BarrageJammer  Code Generation. 
phased.ConstantGammaClutter  Code Generation. 
phased.FreeSpace 

phased.RadarTarget  Code Generation. 
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Detection and System Analysis  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
phased.CFARDetector  Code Generation. 
phased.MatchedFilter 

phased.RangeDopplerResponse 

phased.StretchProcessor  Code Generation. 
phased.TimeVaryingGain  Code Generation. 
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
 
 
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Motion Modeling and Coordinate Systems  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
phased.Platform  Code Generation. 
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs.  
Does not support variablesize inputs. 
Function  Remarks and Limitations 

 
The output can contain fewer NaNs than the MATLAB output. However, if the input contains a NaN, the output contains at least one NaN.  
VariableSizing Restrictions for Code Generation of Toolbox Functions  
—  
—  
—  

Function  Remarks and Limitations 

—  
—  
—  
 
 
— 
Function  Remarks and Limitations 

 
 
VariableSizing Restrictions for Code Generation of Toolbox Functions  
 
 
 

Function  Remarks and Limitations 

—  
—  
 
 
 
—  
 
—  
 
 
 
—  
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.  
— 
C and C++ code generation for the following functions requires the Signal Processing Toolbox™ software. These functions do not support variablesize 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 

Window length must be a constant. Expressions or variables are allowed if their values do not change.  
Window length must be a constant. Expressions or variables are allowed if their values do not change.  
besselap  Filter order must be a constant. Expressions or variables are allowed if their values do not change. 
—  
Window length must be a constant. Expressions or variables are allowed if their values do not change.  
Window length must be a constant. Expressions or variables are allowed if their values do not change.  
Window length must be a constant. Expressions or variables are allowed if their values do not change.  
Filter order must be a constant. Expressions or variables are allowed if their values do not change.  
Filter coefficients must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All Inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
—  
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.  
—  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
Inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
Filter coefficients must be constants. Expressions or variables are allowed if their values do not change.  
—  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constants. Expressions or variables are allowed if their values do not change.  
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.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
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.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
—  
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.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
—  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
The upsampling and downsampling factors must be specified as constants. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
—  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
All inputs must be constant. Expressions or variables are allowed if their values do not change.  
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. Variablesize inputs are not supported.  
Either declare input n as constant, or use the assert function in the calling function to set upper bounds for n. For example, assert(n<10)  
—  
If specified, the order of recursion must be a constant. Expressions or variables are allowed if their values do not change. 
Function  Remarks and Limitations 

 
 
—  
—  
NaN or nan 

—  
—  
— 
Function  Remarks and Limitations 

—  
Always returns a complex result.  
Always returns a complex result.  
—  
—  
—  
—  
—  
—  
—  
—  
—  
Output is always complex.  
Output is always complex.  
—  
— 
Function  Remarks and Limitations 

 
 
 
 
VariableSizing Restrictions for Code Generation of Toolbox Functions  

C and C++ code generation for the following functions requires the Statistics Toolbox™ software.
Function  Remarks and Limitations 

—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
Input dim cannot be empty.  
Input dim cannot be empty.  
If order is nonintegral and X is real, use moment(complex(X), order).  
If the input is variablesize and is [] at run time, returns [] not NaN.  
—  
—  
—  
—  
—  
—  
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
 
—  
—  
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
—  
—  
—  
Can return a different sequence of numbers than MATLAB if either of the following is true:
 
—  
— 
Function  Remarks and Limitations 

 
—  
—  
—  
 
 
 
—  
 
—  
 
 
 
 
—  
 
—  
strcmpi  Input values from the char class must be in the range 0127. 
strfind 

strjust  — 
—  
 
 
—  
 

Function  Remarks and Limitations 

 
—  
— 
Function  Remarks and Limitations 

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