This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

MATLAB Code Examples

Standalone Examples

A standalone example is a readable version of a MATLAB® script that shows how to accomplish a particular task. MATLAB and all MATLAB toolboxes include examples as part of the installed documentation. (Before release R2012b, these examples were called demos.)

Access examples by clicking Examples on the right of the main documentation page for a particular product. You can also access examples by clicking the icon to the right of the product name.

For instance, MATLAB includes various examples that demonstrate mathematics functionality.

Each example combines comments, code, and output together in a formatted document. You can open the corresponding script in the Editor by clicking the icon to the right of the example name, or by clicking Open this Example at the top of the example page in the Help browser.

In the Editor, there are two ways to run the script:

  • Run one section at a time and view the incremental results. Select the first section, and then step through the script by clicking Run and Advance, .

  • Run the entire script by clicking Run, .

Additional examples, created by members of the MATLAB community, are available at the File Exchange.

Inline Examples

The product documentation also includes inline code excerpts, such as examples on function pages like cos or plot. You can run inline code from the Help browser by selecting the code, right-clicking, and then selecting Evaluate Selection, as shown. (On Macintosh systems, press Shift+F7, which copies code to the Command Window for evaluation.)

See Also


Related Examples

External Websites

Was this topic helpful?