Re: Break Line
- From: roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson)
- Date: Fri, 1 Feb 2008 20:02:33 +0000 (UTC)
In article <0231e91f-4157-46c1-bdad-07d3aa9057d4@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
shapper <mdmoura@xxxxxxxxx> wrote:
When I am writing a line code in Matlab Editor and I need to break the
line do I need to add the 3 dots?
For example:
history = struct('title', {my title}, ...
'description', {my description});
Yes.
The one place that I have found that you do *not* need the three
dots is in creating a matrix, such as
foo = [ 1 2 3
4 5 6
7 8 9 ];
When this syntax is used, the line break is treated as a ';', as if
you had written,
foo = [ 1 2 3; ...
4 5 6; ...
7 8 9 ];
If you accidently forget a ... in the middle of a vector you are
creating, and by chance you happen to have the same number of elements
before and after the break, you will end up with a 2 x N array
instead of the 1 x (N*2) array you expected. This can produce
sudden surprises later! (If the number of elements does not match
then you get lucky and it will complain as soon as it attempts to
execute the statement.)
--
"Okay, buzzwords only. Two syllables, tops." -- Laurie Anderson
.
- References:
- Break Line
- From: shapper
- Break Line
- Prev by Date: Re: order of eigenvalues
- Next by Date: Re: choosing interpolation method
- Previous by thread: Break Line
- Next by thread: wav files(reading and playing back)
- Index(es):
Relevant Pages
|
Loading