Guy on Simulink

Simulink & Model-Based Design

What’s New in R2018a!

MATLAB R2018a is now available, let's go through a few of my favorite enhancements to Simulink in this release.


It has been a long time since we added a new section to the Simulink section of the Library Browser. In this release, we are adding two!

The first one is called Strings. As its name implies, a new set of blocks is added to Simulink to manipulate strings. Since this is a big topic, I will very likely write a post dedicated to Simulink Strings soon.

For today, here is a picture of the blocks available to create and manipulate strings in Simulink.

Strings blocks

More Quick Insert Blocks

Since the Quick Insert capability has been released a few years ago, I almost never use the Simulink Library Browser anymore. Instead, I type block names in the Simulink canvas to add them to models. With that workflow, I have to admit that I often end up typing things like:

  • "inp" hoping to get a Inport block
  • "cos" hoping to get the Trigonometric Function block configured for the cosine operation
  • "and" hoping to get the Logical Operator block configured for AND
  • "floor" hoping to get the Rounding block configured to floor
  • "log" hoping to get the Math function block configured for log
  • "one" hoping a Constant block outputting a value of 1

Good news! All the items on that list now work with Quick Insert!

Quick Insert One

Look at the Library Browser to see the list of blocks added to the Quick Insert list:

List of Quick Insert block

Simulation Pacing

For many years, we have been offering various options to make a Simulink model run in real time. This includes Simulink Real-Time, which allows you to generate code from a Simulink model and run it in real-time on a dedicated machine. This also includes Simulink Desktop Real-Time, which also generates code, but can run in real-time on the same Windows or Mac machine as MATLAB is running.

In R2018a, we are adding to Simulink a more lightweight pacing option. It cannot speed up your model if it is running slower than real-time like the two options above. However, if your model is running very fast and you would like to simply slow it down to something close to real-time, this option is for you.

I personally find this feature very useful when a user is supposed to interact with the simulation while it is running, for example through a MATLAB App.

To enable pacing, from the Simulation menu click on the Pacing Options entry:

Pacing Menu

In the pacing dialog, enable the pacing and select how fast relative to real-time you want the model to run.

Pacing Menu

Sample Time Legend

If you are like me and often dealing with multi-rate models, you probably ended up at some point spending more time than you would have like to searching deep down a hierarchy of subsystems for one block running at an unexpected rate. If this is the case, you will enjoy this enhancement.

In addition to a new look and feel, the Sample Time Legend now allows you to highlight blocks executing at a specific rate.

Sample Time legend and Highlighting

Port Connection Cues

I never thought I would say this, but no need to drag lines to connect blocks anymore!

In R2018a, when you click on a port, Simulink immediately highlights ports to which it could potentially be connected to in its surroundings. You can then click on the desired port and the connection is made using what we consider the most optimal route.

For Simscape blocks, only ports of the same domain are highlighted.

Port Connection Cues

Flexible SimState Restore

As you probably know, before R2018a, it was possible to save the SimState of a simulation at a specific time and restart the simulation from this point. This is very useful if you need to run multiple simulations that have an identical initialization phase, and then diverge after some time. A good example of that is a plane taking off always in the same way, but doing different maneuvers while in the air.


One of the main restrictions in that workflow was that it was impossible to modify the model before restarting the simulation. In R2018a, we decided to relax this limitation and allow some modifications to help debugging.

The modifications allowed to the model should not change simulation results, but will allow you to gather more information. This includes adding or removing Scope blocks, Display blocks, To Workspace blocks and To File blocks. We also allow changing which signals are logged.

As far as I can see, this enhancement will help me avoid situations where I wait for a long time for a simulation to complete to finally realize, "Oh no! I should have logged that signal too!"

Hit Crossing Messages

Recently, I have been playing more and more with SimEvents and Messages in Stateflow. Those offer some pretty interesting and powerful semantics.

When modeling hybrid systems combining continuous dynamics and event-based logic, the new option of the Hit Crossing block to output a message can be very useful.

Hit Crossing Message

For a more complete example, I recommend looking at the SimEvents example seExampleTankFilling

Now it's your turn

Have a look at the Simulink R2018a release notes and let us know what is the most important addition for you, and which features you would like to hear about on this blog.

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.