Many of the demo files that come with MATLAB are written as cell mode scripts. This allows us to publish them into the doc, but did you know there is also an interactive way to view cell mode demos? Take a look at demos such as penny, integerMath, or nddemo. To browse our script demos, use the demos command. You can open a demo in the editor with edit or in the help browser with showdemo.
However you can run through a demo one cell at a time in the Command Window with echodemo. Each cell is displayed in turn with the cell’s text printed out and the code executed. The cell’s paragraph text is displayed with hyperlinks for moving to the next cell or stopping the demo. One advantage to showing demos in this is fashion is that since you are at the Command Window, you can run additional code or query variables at each step.
By
Michael Katz
Mike is a developer on the MATLAB Mobile team. When not describing himself in the third person, biking, homebrewing, or rooting for the home team, he's busy trying to make the world a better place for programming.
ECHODEMO is neat, but it doesn’t work very well when the cell’s text is longer than the height of the command window – the header gets scrolled off the screen so you can’t access the hyperlinks to get to the next cell without some manual scrolling back and forth…