Guy on Simulink

Simulink & Model-Based Design

Welcome to the Coders! 9

Posted by Guy Rouleau,

Blogger, Guy RouleauBy Guy Rouleau

Did you already install MATLAB R2011a?

If you are used to generating code from Simulink, the first thing you probably thought after launching MATLAB R2011a is: "Where is Real-Time Workshop?"

Don't panic, this is normal! All good things have an end; it is now time to say goodbye Real-Time Workshop, and welcome Simulink Coder. I officially proclaim: Le Roi est mort, vive le Roi!

Consolidation of Code Generation Products

Before introducing the cool new Simulink R2011a features, I want to describe a significant reorganization of the code generation products. Since an image is worth a thousand words, here is what happened:

Change in product names in MATLAB R2010a

Let's describe how features are divided among these three products:


Traditionally, MathWorks code generation products have all been centered around Simulink. However in the last few years we've received more and more requests to generate code for prototyping and embedded processors directly from MATLAB code. It is difficult to admit for a Simulink fan like me, but it is true that some algorithms are easier to implement in MATLAB code than using blocks. This is particularly the case for many algorithms in digital signal processing and communications systems.

In addition to all the Embedded MATLAB features previously included with Real-Time Workshop, MATLAB Coder includes some cool new stuff, for example the coder function to start a MATLAB Coder Project using a graphical interface:

MATLAB Coder Project Interface

Simulink Coder

Simulink Coder combines the previous functionality of Real-time Workshop and Stateflow Coder. This means one single product to generate code for all Simulink multidomain models, regardless of which add-on products are used to create those models.

Embedded Coder

The Embedded Coder consolidates all MathWorks code generation tools for embedded system development into a single product:

  • The previous features of Real-Time Workshop Embedded Coder for generating production embedded code.
  • Processor and board specific customization previously included with Target Support Package.
  • Tools to integrate popular embedded toolchains previously included with Embedded IDE Link.

Now it's your turn

Are you going to take advantage of the new MATLAB Coder? Let us know how by leaving a comment here.

9 CommentsOldest to Newest

Allan Baker replied on : 1 of 9

Hopefully all of these have been thoroughly tested with 64-bit distributed cluster machines (Simulink accelerator and embedded matlab mex) and also using embedded Matlab cstructname with externally defined header files (mex and code-gen). Been having awful luck with upgrades lately.

Does this upgrade change the TLC files tremendously from 2010B to 2011A?

Thomas Marullo replied on : 2 of 9

I use Simulink with RTW and xPC Target to create real-time systems. I also use the Matlab Embedded Simulink blocks to write custom code within my Simulink models. I see that with newer versions, RTW is now Simulink Coder. Do I also have to puchase Matlab Coder in order to get the Matlab Embedded Code blocks in Simulink?


tom erkkinen replied on : 3 of 9

Hi Thomas – Simulink Coder now requires MATLAB Coder, just like Simulink requires MATLAB, so yes you need MATLAB Coder to use Simulink Coder.

If you subscribe to MathWorks Software Maintenance Service (SMS) and update to 11a, then you will automatically get MATLAB Coder with Simulink Coder (for the RTW transition) and don’t need to purchase MATLAB Coder separately.

I’m curious – What type of code/logic do you write with the MATLAB block?

tom erkkinen replied on : 4 of 9

Hi Allan,

The migration from RTW to Simulink Coder should be smooth. I’ve had several customers and embedded target partners report quick migration even during beta usage. Check out our release notes for version compatiblity topics (e.g, the ver command had a slight change). But let us know if you have issues.

Thomas Marullo replied on : 5 of 9

Hi Tom,
Thanks for the info. I use Embedded Matlab Function blocks, or now Matlab Function blocks to take Matlab code we use for Finite Element analysis and use it in xPC Target. It is very difficult to convert those 100s of lines of code into Simulink code so the Matlab Function blocks are useful for porting M files into Simulink.

Hans Hoelzer replied on : 6 of 9

Seems like we have come full circle (or mostly so). Was there not a product in the past called the Matlab compiler (not to be confused with the current Matlab compiler which is actually a wrapper generator and Matlab interpreter em bedder) which translated Matlabese into C code? As I recall there was also a math library and a graphics library. How does the current offering differ from that one?

Seth Popinchalk replied on : 7 of 9

@Hans Hoelzer – You are right, the old MATLAB Compiler technology did not rely on the MATLAB Common Run-time (MCR) and did generate C/C++ code. That older incarnation of the compiler also relied on MATH and Graphics libraries that contained most of the core MATLAB functionality.

The MATLAB Coder technology is very different from that old MATLAB Compiler. The MATLAB Coder is focused on generating readable C/C++ code from a subset of the MATLAB language, and does not rely on libraries. I think it will be most used by people developing algorithms that need to be deployed to embedded systems, or integrated into larger applications. For desktop application deployment, the MATLAB Compiler and builder products will still provide a better path that supports the full MATLAB language.

I reccomend watching the overview video on the MATLAB Coder product page.

luhur replied on : 8 of 9

Hi guy…

as we know in real-time windows target they don’t support winAPI 32 to handle real-time, right??? what about the NEW ERA of RTWT aka SIMULINK CODER in MATLAB 2011a??? cause i’m trying to wrap my C program in simulink using legacy code tool and then run it on real-time condition.. any suggestion or info about that???

Guy Rouleau replied on : 9 of 9

@Luhur: Unfortunately, the change to Simulink Coder does not affect the fact that RTWT is incompatible with Win32 API calls.

Add A Comment

Your email address will not be published. Required fields are marked *


Preview: hide