Code Generator

emmtrix Code Generator icon

Our Solution for MATLAB® Gode Generation

emmtrix Code Generator (eCG) translates MATLAB®, GNU Octave or Scilab code into platform-independent and readable C or C++ code suitable for embedded processors. The generated code is easy to understand, prepared for parallelization and can be adjusted to individual requirements. Automatically generated reports help with the code certification process. In combination with emmtrix Parallel Studio, eCG enables multicore programming  or vectorization directly from *.m or *.sci script files. Furthermore, eCG works hand in hand with emmtrix Model Code Generator to support C code generation from Simulink models.

eCG Workflow

emmtrix Code Generator Workflow

emmtrix Code Generation uses *.m script files (MATLAB® or GNU Octave) or *.sce/sci script files (Scilab) as input and generates sequential C code according to C89, C99 or C11 standards as ouput. All generated source and header files can be directly compiled without dependencies to external libraries. A direct generation of executable file is further possible. When fixed-point data types are used, it employs C++ templates to represent them.

The generated C code is static and free of dynamic memory allocation. It is prepared for embedded systems and for parallelization tools like emmtrix Parallel Studio. Data dependencies can easily be analyzed. Matrices are represented by multi-dimensional arrays to enable loop transformation required for parallelization or vectorization.

The user can extend their input scripts by special eCG directives (like pragmas in C). These directives are treated as comments by the original tools and therefore code compatibility is guaranteed. The special directives may be used to provide additional information inside the output code, select different algorithm for built-in functions like fft or enable various code optimization to improve performance, memory consumption or parallelizability.

emmtrix Code Generator icon


  • ISO C90, C99, C11, C18, C++98, C++11, C++14 and C++17 compliant code generation
  • Performance & memory analysis
  • Highly comprehensive target-optimized C/C++ code
  • User-controlled cache and memory optimization
  • Bidirectional traceability via code generation reports
  • Embedded code generation without dynamic memory allocation
  • Interfacing custom C/C++ code or libraries
  • Automatable back-to-back tests for functional validation
  • Usable within continuous integration processes
  • Automatic floating-point to integer number conversion
  • Profiling-based performance analysis and visualization within GUI
  • Worst-case analysis
  • Optional array bound checking within generated code

Supported MATLAB®/GNU Octave/Scilab Language Features

  • N-dimensional arrays
  • Matrix operations
  • Processing of multiple input files
  • Variable-sized variables (growing arrays)
  • Subscripting, linear and logical indexing
  • Double-precision, single-precision, and integer data types
  • Complex numbers
  • Fixed-point arithmetic
  • Program control statements if, for, while, break, continue and switch/case
  • Arithmetic, relational, and logical operators
  • Function handles

  • Structures and array of structures
  • Global variables
  • Recursive function calls
  • Global and local functions
  • Functions with variable-length input/output arguments
  • Over 100 MATLAB®/GNU Octave/Scilab functions supported

For more information on emmtrix Code Generator or to request a demo, use our contact form or get directly in touch.

Portrait Rainer Heim

Rainer Heim