This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Run example script step-by-step in Command Window


echodemo filename



echodemo filename runs the script specified by filename step-by-step in the Command Window. If file contains sections, echodemo treats each section as a step and pauses after each one. For more information about sections, see Code Sections.

At each step, you can click links in the Command Window to proceed or stop. If the Command Window is not large enough to show the links, scroll up to see them.


If variables in your base workspace have the same name as variables that the example file creates, the example could overwrite your data. Preserve your data by saving it to a MAT-file before running the example.


echodemo(filename,index) starts with the section number specified by index. If the example relies on results of previous steps, using this syntax can produce errors or unexpected results.


collapse all

Run an example script that demonstrates how to work with multidimensional arrays step-by-step.

echodemo MultidimensionalArraysDemo
Click Next to continue or Stop to end     MultidimensionalArraysDemo.m (1/10)

 This example shows how to work with arrays having more than two dimensions.
 Multidimensional arrays can be numeric, character, cell, or structure arrays.
 Multidimensional arrays can be used to represent multivariate data. MATLAB®
 provides a number of functions that directly support multidimensional arrays.

Run an example script that demonstrates how to work with multidimensional arrays step-by-step, starting from the third section.

filename = 'MultidimensionalArraysDemo';
index = 3;
Click Next to continue or Stop to end     MultidimensionalArraysDemo.m (3/10)
 The |cat| function is a useful tool for building multidimensional arrays.
 |B = cat(DIM,A1,A2,...)| builds a multidimensional array by concatenating |A1,
 A2 ...| along the dimension |DIM|.

B = cat( 3, [2 8; 0 5], [1 3; 7 9], [2 3; 4 6])

B(:,:,1) =

     2     8
     0     5

B(:,:,2) =

     1     3
     7     9

B(:,:,3) =

     2     3
     4     6

Input Arguments

collapse all

Script file name, specified as a character vector or string scalar.

Section index, specified as a scalar integer.

The link text in the Command Window shows the current section number, n, and the total number of sections, m, as n/m.


  • echodemo does not support functions or live code files (*.mlx). echodemo can run any script (*.m) that you can execute, but only scripts with sections pause between steps.

See Also

| |

Introduced before R2006a