Skip to Main Content Skip to Search
Product Documentation

echo - Display statements during function execution

Syntax

echo on
echo off
echo
echo fcnname on
echo fcnname off
echo fcnname
echo on all
echo off all

Description

The echo command controls the display (or echoing) of statements in a function during their execution. Normally, statements in a function file are not displayed on the screen during execution. Command echoing is useful for debugging or for demonstrations, allowing the commands to be viewed as they execute.

The echo command behaves in a slightly different manner for script files and function files. For script files, the use of echo is simple; echoing can be either on or off, in which case any script used is affected.

echo on

Turns on the echoing of commands in all script files

echo off

Turns off the echoing of commands in all script files

echo

Toggles the echo state

With function files, the use of echo is more complicated. If echo is enabled on a function file, the file is interpreted, rather than compiled. Each input line is then displayed as it is executed. Since this results in inefficient execution, use echo only for debugging.

echo fcnname on

Turns on echoing of the named function file

echo fcnname off

Turns off echoing of the named function file

echo fcnname

Toggles the echo state of the named function file

echo on all

Sets echoing on for all function files

echo off all

Sets echoing off for all function files

See Also

function

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS