| MATLAB® | ![]() |
| On this page… |
|---|
The MATLAB® product and related products include demos that you can access from the Help browser Demos pane.
There are four types of demos:
M-file: Demos that tell a step-by-step
story, including source code, commentary, and output. They are published
from M-file scripts to HTML output using the Editor. The first comment
line of the demo M-file begins with two comment symbols (%%), and similarly, two comment symbols (%%) create a cell for each step. The MATLAB Graphics Square Wave from
Sine Waves demo is an M-file type demo.
M-GUI: Standalone tools for exploring
a feature. An example is the MATLAB Graphics Vibrating Logo demo.
Model: Simulink® block diagrams. An example
is the Engine Timing Simulation demo.
Video: Movies that highlight key features
in a tool. They play in your system browser and require the Macromedia
Flash Player plug-in. Some also require an Internet connection. An
example is the MATLAB Desktop and Command Window demo.
The MATLAB code and Simulink blocks used in the demos (except videos) are available for you to view and copy for use in your own applications.
See also Examples for each product in the Contents pane. These examples are similar to demos but are integrated in the documentation.
To access demos for the products you have installed,
Click the Demos tab in the Help Navigator.
You can also access demos from the Start button, by using the demo function, or from the Help menu for some tools.
Click the + for a product area to list the products or categories that have demos. Then click + for a product or product category to list its demos.
All demos for that product or product area are listed in the display pane, and each includes the type of demo along with a thumbnail image that represents output from the demo.
Select a specific demo. Information about the demo appears in the display pane.

You can then view and run the demo, with specific options depending on the type of demo:
For M-file demos, click the Open filename in the Editor link at the top left. This opens the M-file in the Editor. From the Editor, run the demo step by step by selecting Cell > Evaluate Current Cell and Advance.
You can also click Run in the Command Window, and then follow the instructions that appear in the Command Window. You might need to scroll up to see all of the instructions.
For M-GUI demos, click the Open filename in the Editor link at the top left. This opens the M-file in the Editor.
Click the Run this demo link at the top right to start the GUI. Then follow the instructions in the GUI to proceed through the demo.
For Model demos, click Open this model to open the block diagram.
For Video demos, click the Run this demo link in the top right to play the video. These demos run in your system browser and require the Macromedia Flash Player plug-in. Some also require an Internet connection.
When you double-click a demo name in the Help Navigator pane, the demo file opens for M-file and Model demos, or runs for M-GUI and Video demos.
The following example shows the results of running the MATLAB Graphics Square Wave from Sine Waves demo (xfourier). In it, MATLAB generates a series of plots, culminating in the final one shown here.

You can use the Help browser search feature to find demos. Search find words in comments or code for M-file and Model types demos. It finds comments in the M-file help for M-GUI demos. It does not search video demos. For instructions, see Search Documentation and Demos with the Help Browser.
M-file demos run as scripts. Their variables are created in the base workspace for MATLAB. If you have variables in the base workspace when you run an M-file demo, and the demo uses an identical variable name, there could be problems due to variable name conflicts. For example, a variable of yours might be overwritten by the demo. The demo's variables remain in the base workspace until you clear them or quit MATLAB.
To open the Demos pane in the Help browser, type demo in the Command Window. You can go directly to the demos for a specific product. For example
demo toolbox signal
opens the Demos listing for Signal Processing Toolbox™ product.
To run an M-GUI demo, type the demo name in the Command Window. For example, type
vibes
to run the MATLAB Graphics demo showing an animated L-shaped membrane.
To run an M-file demo step by step from the Command Window, type echodemo followed by the demo name. For example, run
echodemo xfourier
Typing the demo name for an M-file demo runs the demo, but not step by step.
Typing the name of a model demo opens the block diagram.
You can add your own demos so they appear in the Demos pane. For details, see Adding Your Own Toolboxes to the Development Environment in the HTML documentation (in the Help browser, or on the Web site).
![]() | Viewing Documentation in the Help Browser | Preferences for the Help Browser | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |