Programming Previous page   Next Page

Command and Function Syntax

This section covers the following topics:

Syntax Help

For help about the general syntax of MATLAB functions and commands, type

Command and Function Syntaxes

You can enter MATLAB commands using either a command or function syntax. It is important to learn the restrictions and interpretation rules for both.

For more information: See Calling Functions in the MATLAB Programming documentation.

Command Line Continuation

You can continue most statements to one or more additional lines by terminating each incomplete line with an ellipsis (...). Breaking down a statement into a number of lines can sometimes result in a clearer programming style.

Note that you cannot continue an incomplete string to another line.

For more information: See Entering Long Lines in the MATLAB Desktop Tools and Development Environment documentation.

Completing Commands Using the Tab Key

You can save some typing when entering commands by entering only the first few letters of the command, variable, property, etc. followed by the Tab key. Typing the second line below (with T representing Tab) yields the expanded, full command shown in the third line:

If there are too many matches for the string you are trying to complete, you will get no response from the first Tab. Press Tab again to see all possible choices:

For more information: See Tab Completion in the MATLAB Desktop Tools and Development Environment documentation

Recalling Commands

Use any of the following methods to simplify recalling previous commands to the screen:

For more information: See Recalling Previous Lines and Command History in the MATLAB Desktop Tools and Development Environment documentation.

Clearing Commands

If you have typed a command that you then decide not to execute, you can clear it from the Command Window by pressing the Escape (Esc) key.

Suppressing Output to the Screen

To suppress output to the screen, end statements with a semicolon. This can be particularly useful when generating large matrices.


Previous page  Programming Tips Help Next page

© 1994-2005 The MathWorks, Inc.