Programming Previous page   Next Page

Comma -- ,

A comma is used to separate the following types of elements.

Row Element Separator

When constructing an array, use a comma to separate elements that belong in the same row:

Array Index Separator

When indexing into an array, use a comma to separate the indices into each dimension:

Function Input and Output Separator

When calling a function, use a comma to separate output and input arguments:

Command or Statement Separator

To enter more than one MATLAB command or statement on the same line, separate each command or statement with a comma:

Curly Braces -- { }

Use curly braces to construct or get the contents of cell arrays.

Cell Array Constructor

To construct a cell array, enclose all elements of the array in curly braces:

Cell Array Indexing

Index to a specific cell array element by enclosing all indices in curly braces:

See Cell Arrays for more information.

Dot -- .

The single dot operator has the following different uses in MATLAB.

Structure Field Definition

Add fields to a MATLAB structure by following the structure name with a dot and then a field name:

See Structures for more information.

Object Method Specifier

Specify the properties of an instance of a MATLAB class using the object name followed by a dot, and then the property name:

See MATLAB Classes for more information.

Dot-Dot -- ..

Two dots in sequence refer to the parent of the current directory.

Parent Directory

Specify the directory immediately above your current directory using two dots. For example, to go up two levels in the directory tree and down into the testdir directory, use


Previous page  Asterisk -- * Dot-Dot-Dot (Ellipsis) -- ... Next page

© 1994-2005 The MathWorks, Inc.