This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this 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 or bottom left 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.

MATLAB include various examples that demonstrate various functionality. For instance, click on Graphics to view examples demonstrating plotting functionality in MATLAB.

Each example combines comments, code, and output together in a formatted document. You can open the corresponding script in the Editor by clicking Open Script or Open Live Script to the right of the example name, or by clicking Open Script or Open Live Script 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 or Run All .

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 Topics

External Websites

Was this topic helpful?