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.)

2 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.

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).


Seth Popinchalk is an Application Engineer for The MathWorks. He writes here about Simulink and other MathWorks tools used in Model-Based Design.
  • Mohamamd: Hi Suth, I try to simulate a load tap-changing transformer in simulink but its control part has to be...
  • Han Geerligs: Hello Guy, thanks for the clarificaton and link. However in the documentation I am missing the...
  • Guy: @Han, you probably already know, but I think it is good to share with everyone. To zoom in use the key...
  • Han Geerligs: Hi Seth, Once again I’d like to point out that my biggest accelerator is using mouse and keyboard...
  • XaL: Hi, thanks for the tips. As someone wrote in http://blogs.mathwor ks.com/seth/2009/03/ 13/new-%C2%A0rele...
  • Uba osy: Hi, in the introductory example for fuzzy logic toolbox it was noted that using non fuzzy means, you could...
  • Prashant: How can I have same example but instead AC(1 to 10V 50 or 60Hz) and DC(0.5 to 10 V) then adding AC+DC but...
  • adrian chavarro: Great tool, for educational and sicentific, simulation. I would like to know where can i place a...
  • Ashish Sadanandan: @wei, I was talking about the case where the compiler would perform the ‘model_Xdim...
  • wei: @Ashish, I agree with your observation on compiler optimization but fail to see why Han’s code would be...

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