What does '...' mean in MATLAB?
315 views (last 30 days)
Douglas Alves on 13 May 2014
I came across this script and I've seen h = ... what does it mean?
axis(1.2*[-1 1 -1 1])
x = 0;
y = 1;
h = ...
n = 2*pi/h;
for k = 1:n
x = x + h*y;
y = y - h*x;
Benjamin Avants on 13 May 2014
The three dots '...' tell matlab that the code on a given line continues on the next line.
It is used so that command lines don't stretch out too long to print or read easily.
This code is interpreted as a single set command with multiple parameters.
In the script you posted, the line in question would actually be interpreted like this:
h = n = 2*pi/h;
which should cause an error.
Whoever wrote the script must be using it as a place holder for something else.
More Answers (1)
per isakson on 13 May 2014
Edited: per isakson on 13 May 2014
doc on Special Characters says
Continuation. Three or more periods [...] at the end of a line continue the current function on the next line. Three or more periods before the end of a line cause the MATLAB® software to ignore the remaining text on the current line and continue the function on the next line. This effectively makes a comment out of anything on the current line that follows the three periods. For an example, see Continue Long Statements on Multiple Lines.