Demos in the Help Browser

About Demos

The MATLAB® product and related products include demos that you can access from the Help browser Demos pane.

There are four types of demos:

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.

Using Demos

To access demos for the products you have installed,

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

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

  3. Select a specific demo. Information about the demo appears in the display pane.

    Image of Demos panel. Click the Demos tab to display it. All installed products display. Expand a product's listing to see all its demos, then select a demo. Use links in the display pane to view the demo code or to run the demo.

  4. You can then view and run the demo, with specific options depending on the type of demo:

    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.

    Image of demo output.

Searching for Demos

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.

Running Demos and Base Workspace Variables

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.

Function Alternative

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.

Adding Your Own Demos

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

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS