Auto Electronics

MathWorks’ Embedded MATLAB streamlines C code generation

The MathWorks has developed Embedded MATLAB, a subset of its MATLAB high-level programming language that allows users to generate embeddable C code from MATLAB files without having to go through Simulink, The Mathworks’ graphical environment.

Jim Tung, a MathWorks Fellow, says Embedded MATLAB will appeal to MATLAB users who are designing algorithms and want to generate embeddable C code quickly, without Simulink. It will also facilitate the sharing of algorithms for system design.

MATLAB is commonly used for expressing idealized algorithms that require extensive simulation before they can be implemented, while Simulink has been used for automatic generation of C and C++ code for a decade, and more recently for generation of VHDL and Verilog code, but Tung noted that users focused on algorithm development may not have access to Simulink or may not be trained to use it. They also may not have or may not need an understanding of the system of which their algorithm is a part.

Another use case, according to Tung, involves workflow across groups in which some engineers create reusable components while others are design systems that use those components. “It was often the case that algorithms expressed in MATLAB were manually translated to C and converted to fixed point code,” he said.

“The manual process wastes time and resources, and results in two design ‘truths,’ the original expression in MATLAB and the C code translation. This creates a configuration management problem, but with Embedded MATLAB, the algorithm as created in MATLAB does not have to be changed. Algorithms created in MATLAB can be passed directly to Real Time Workshop, which automatically generates C code.”

Tung said Embedded MATLAB also facilitates workflow between algorithm developers and system developers. “In the past, Simulink users could hardwire MATLAB code into a Simulink function block and generate C code from there. The code then became part of the Simulink model. Now, it’s easier for Simulink users to incorporate multiple algorithms into their model. It’s also possible for Simulink users to generate HDL code for MATLAB blocks,” he said.

Embedded MATLAB is included in the latest MATLAB release (2007B) at no additional cost.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish