Main Content

Code Generation and Acceleration Support

Generate C code from MATLAB® code and Simulink®, and use GPUs to accelerate processing

You can generate C code from your MATLAB and Simulink model designs. Some Communications Toolbox™ blocks and System objects provide support for C code generation when you use them with MATLAB Coder™. You can speed up your code while prototyping. Communications Toolbox includes some functions that can execute on a Graphics Processing Unit (GPU).

C/C++ Code Generation.  After you develop your application, you can generate portable C/C++ source code, standalone executables, or standalone applications from your MATLAB code and Simulink models. C/C++ code generation enables you to run your simulation on machines that do not have MATLAB installed and to speed up processing while you work in MATLAB. For a list of Communications Toolbox features that support C/C++ code generation, see Functions and System Objects Supporting C Code Generation. You need MATLAB Coder to generate C/C++ code. For more information, see Generate C Code from MATLAB Code Video.

GPU Code Acceleration.  To speed up your code while prototyping, Communications Toolbox includes some features that can execute on a Graphics Processing Unit (GPU). You can use the gpuArray (Parallel Computing Toolbox) function to transfer data to the GPU and then call the gather (Parallel Computing Toolbox) function to retrieve the output data from the GPU. For a list of Communications Toolbox features, see GPU Arrays Support List for System Objects. You need Parallel Computing Toolbox™ to enable GPU support.


MATLAB CoderGenerate C code or MEX function from MATLAB code


codegenGenerate C/C++ code from MATLAB code
gatherTransfer distributed array, Composite object, or gpuArray object to local workspace
gpuArrayArray stored on GPU