Symbol Symbol Name Role Description Examples
. Period or dot
- Decimal point
- Element-wise operations
- Structure field access
- Object property or method specifier
The period character separates the integral and fractional parts of a number, such as 3.1415.
MATLAB operators that contain a period always work element-wise. The period character also
enables you to access the fields in a structure, as well as the properties and methods of an object.
- “Array vs. Matrix Operations” on page 2-13
- “Structures”
- “Access Property Values”
Decimal point:
102.5543
Element-wise operations:
A.*B
A.^2
Structure field access:
myStruct.f1
Object property specifier:
myObj.PropertyName
...
Dot dot dot or
ellipsis
Line continuation
Three or more periods at the end of a line continues the current command on the next line. If three
or more periods occur before the end of a line, then MATLAB ignores the rest of the line and
continues to the next line. This effectively makes a comment out of anything on the current line that
follows the three periods.
NoteMATLAB interprets the ellipsis as a space character. Therefore, multi-line commands must be
valid as a single line with the ellipsis replaced by a space character.
- “Continue Long Statements on Multiple Lines” on page 1-2
Continue a function call on the next line:
sprintf(['The current value '...
'of %s is %d'],vname,value)
Break a character vector up on multiple lines and concatenate the lines together:
S = ['If three or more periods occur before the '...
'end of a line, then the rest of that line is ' ...
'ignored and MATLAB continues to the next line']
To comment out one line in a multiline command, use ... at the beginning of the line to ensure that the
command remains complete. If you use % to comment out a line it produces an error:
y = 1 +...
2 +...
% 3 +...
4;
However, this code runs properly since the third line does not produce a gap in the command:
y = 1 +...
2 +...
... 3 +...
4;
2 Program Components