Comparing Simulink Coder and Simulink Compiler
Simulink® Compiler™ enables you to share Simulink simulations as standalone executables. You can build the executables by packaging the compiled Simulink model and the MATLAB® code to set up, run, and analyze a simulation. Standalone executables can be complete simulation apps that use MATLAB graphics and UIs designed with MATLAB App Designer. To cosimulate with an external simulation environment, you can generate standalone Functional Mockup Unit (FMU) binaries that adhere to the Functional Mockup Interface (FMI) standard.
Simulink Coder™ generates and executes C and C++ code from Simulink models, Stateflow® charts, and MATLAB functions. The generated source code can be used for real-time and non-real-time applications, rapid prototyping, and hardware-in-the-loop testing. You can tune and monitor the generated code using Simulink or run and interact with the code outside MATLAB and Simulink.
Differences
The following table states the major comparisons between Simulink Compiler and Simulink Coder. Use this table to understand the differences between the applications and usage of the two products.
Outputs and Support | Simulink Compiler | Simulink Coder |
---|---|---|
Main Use Case | Deploy simulations as standalone executables on desktop or production servers | Generate portable C/C++ code for Simulink model that can be deployed on embedded platforms or desktop |
Output | Executable or software component or shared library | Portable and readable C/C++ source code |
Simulink Block Support | All the blocks supported in Rapid Accelerator mode in Simulink | A subset of Simulink blocks |
Supported Blocksets | All the blocksets supported by Rapid Accelerator mode in Simulink | A subset of Simulink blocks |
Production | MATLAB Production Server™ | Embedded Coder® |
Simulink Graphics Support | Supports MATLAB Graphics. | None |
Library Dependencies | MATLAB Runtime | None |
Common Questions About Simulink Compiler and Simulink Coder
The following table answers some of the common questions about using Simulink Compiler and Simulink Coder, such as the memory required, performance, and other questions about support.
Common Questions | Simulink Compiler | Simulink Coder |
---|---|---|
What files are produced? | Shared executables or libraries, along with the required MATLAB Runtime components. | Source code (*.c & *.h ) that can be
compiled into shared libraries and executables |
Which platforms can these files be deployed to? | All platforms supported by MATLAB (Windows®, Mac, and Linux®) | Any platform that supports ANSI/ISO C/C++ code |
Does it generate readable code? | No, only non-readable shared libraries | Yes, readable source code |
Is it faster than Simulink? | Runs at the same speed as Rapid Accelerator mode in Simulink. | Has the potential to be faster, depending on the algorithm. The generated code is not faster for optimized MATLAB functions (such as FFT, or Image Processing, and Computer Vision functions) Use GPU Coder GPU Coder™ to generate CUDA® source code that potentially runs faster on NVIDIA® GPUs. |
Does it take advantage of hardware accelerators? | Supports the same hardware as MATLAB, including GPUs and AVX. Multicore and clusters are supported via Parallel Computing Toolbox™ | C code running on local multicore machines can be supported using the OpenMP API. Use GPU Coder to generate CUDA source code that runs on NVIDIA GPUs. Use HDL Coder™ to generate Verilog® or VHDL® that runs on FPGAs. |
What is the difference in memory use on a desktop? | Highly dependent on the executables. MATLAB Runtime itself uses more memory than the Simulink Coder. | Highly dependent on the MATLAB code. |
What file I/O formats does each software support? | Supports all formats supported in MATLAB | Limited file support: text files, audio, and video formats. Does not support image formats. |