Guy and Seth on Simulink

August 28th, 2009

BEEP, Simulink versus MATLAB

Did you ever notice that a BEEP in Simulink means something different from a BEEP in MATLAB?

BEEP, What BEEP?

 What I’m talking about is that bell character you sometimes hear.  In older version of MATLAB (Pre R14), you could actually display a beep on the screen.

>> fprintf('\a')
>> disp(char(7))

In more recent version, the command window doesn’t display the BEEP character.  Instead, you can call the function BEEP.

>> beep

You hear it under different circumstances for Simulink versus MATLAB.

MATLAB BEEP == Error

In MATLAB, the BEEP alerts you to an error.  Sometimes you get it because your calling syntax is wrong, sometimes when the tab completion can’t find anything.  In MATLAB, BEEP is bad.

>> plot(x,y
??? plot(x,y
            |
Error: Expression or statement is incorrect--possibly
unbalanced (, {, or [.

Simulink BEEP == Done

In Simulink, the BEEP happens when your simulation is finished.  It is a beautiful sound.  The BEEP is an alert to tell you the work is done.  The fruit of your simulation is ready to harvest. It is time to review your results. In Simulink, BEEP is a good sound.

>> vdp
>> set_param(bdroot,'SimulationCommand','start')

The VDP model in Simulink

Leave your comments, after the BEEP. (THANK YOU Jeannette for alerting me to the difference.)

3 Responses to “BEEP, Simulink versus MATLAB”

  1. Janti replied on :

    Hi Seth,
    I’m posting a question here as Doug refered to your Simulink blog when I googled the problem I’m having
    link(
    http://blogs.mathworks.com/pick/2008/02/27/advanced-matlab-calling-simulink-from-matlab/
    )

    I’ve got a Simulink question with regards to calling the sim(‘ModelName’) command from within a Matlab Script.

    When running nested functions in a Matlab script each nested function creates its own memory Stack. And when I call the ‘sim’ command from within any nested function it seems to be linked to the base “workspace” memory stack and not the function Stack. Is there a way to link the ‘sim’ memory stack with the memory stack of the function that its called from?

    Cheers,
    Janti

  2. Guy replied on :

    @ Janti: If you look at the documentation for the SIM command, you will see a section titled “Superseding the Base Workspace”. This explains how to use an ‘options’ structure containing the ‘SrcWorkspace’ field that can be used to specify which workspace is searched last during hierarchical symbol resolution.

  3. Sauli replied on :

    How do I get the the bell alert off on MATLAB, btw…? I like having sounds on on my computer in general but hearing the bell everytime I press backspace one too many times drives me nuts…

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


MathWorks
Guy Rouleau and Seth Popinchalk are Application Engineers for MathWorks. They write here about Simulink and other MathWorks tools used in Model-Based Design.

These postings are the author's and don't necessarily represent the opinions of The MathWorks.