Mathworks has split its C and C++ code generation tools into three applications. They include Matlab Coder, Simulink Coder and Embedded Coder. These allow source code to be incorporated into C and C++ applications. Prior to this split, developers using Mathworks tools needed to turn to the Real Time Embedded tools to generate C or C++ code. Now Matlab and Simulink developers only need one additional tool to generate C and C++ code (Fig. 1).
The changes are significant because Matlab and Simulink are often used to develop or prototype applications that will be deployed using C or C++. Hand translation is one way to do this but it is tedious and error prone. It is also a pain to keep the C and C++ code in synch with the Matlab or Simulink code.
The three new tools eliminate a significant chunk of the work of maintaining a C/C++ application that utilizes algorithms developed using Matlab or Simulink. They essentially operate in the same fashion with slighly different starting points and they are complementary since Matlab code can be embedded in Simulink models. The embedded tool is essentially an updated version of the original C/C++ code generation support in the Real-Time Workshop Embedded Coder. It provides more advanced capabilities and requires Matlab Coder and/or Simulink Coder. It allows the user to adjust the look and feel of generated code including coding style as well as function library support. Embedded Coder provides a greater degree of control than Simulink and Matlab Coder at this time.
Matlab Coder features integration with Microsoft's Visual Studio. The tool makes it easy to find find Matlab code from the C/C++ code report.
The C/C++ tends to be 2x to 10x faster than corresponding Matlab code or Simulink models. The tools do not support all features in Matlab. Functional areas not supported include features like GUI interface support. The tools do support over 400 Matlab operators and funtions. In addition over 200 system objects like DSP algorithms are supported as well.
Addressing restricted functionality may mean refactoring a Matlab or Simulink application to move supported functionality into its own set of files. This can make debugging easier. The generated code is license and royalty free but resulting products cannot compete with Mathwords as is the case with regular Matlab applications.
Developers can select C or C++ code generation. The codegen command provides command line or make file support. Matlab Coder users will now only require a Matlab license to generate C/C++ code. The Realtime Workshop support still requires a Simulink license since it handles Matlab and Simulink code.
Pricing for Matlab Coder start at $6,500.