[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected syntax error in Octave 3.2.2
From: |
Bård Skaflestad |
Subject: |
Re: Unexpected syntax error in Octave 3.2.2 |
Date: |
Tue, 27 Apr 2010 09:14:39 +0200 |
On Mon, 2010-04-26 at 23:08 +0200, Søren Hauberg wrote:
> man, 26 04 2010 kl. 14:01 -0700, skrev Sergei Steshenko:
> >
> > --- On Mon, 4/26/10, Bård Skaflestad <address@hidden> wrote:
> >
> > > From: Bård Skaflestad <address@hidden>
> > > Subject: Re: Unexpected syntax error in Octave 3.2.2
> > > To: "address@hidden" <address@hidden>
> > > Date: Monday, April 26, 2010, 4:23 AM
> > > On Mon, 2010-04-26 at 11:28 +0200,
> > > Bård Skaflestad wrote:
> > > > octave:38>
> > > [reshape (1:5, [], 1); -1]
> > > > parse error:
> > > >
> > > > syntax
> > > error
> > >
> > > Follow-up:
> > > Removing the whitespace in front of the opening parenthesis
> > > in the above
> > > statement (i.e., writing [reshape(1:5, [], 1); -1])
> > > produces the
> > > expected result. Moreover, M does not understand the
> > > "[reshape<SPACE>("
> > > syntax either.
> > >
> > > I'm sorry for wasting your time.
> > >
> > >
> > > Best regards,
> > > --
> > > Bård Skaflestad
> > >
> > > <address@hidden>
> > > SINTEF ICT, Applied mathematics
> > >
> > >
> >
> > Are whitespaces in this case meaningful characters ?
>
> This is one of those things coming from trying to be compatible with
> Matlab. Matlab allows you to specify matrix elements without commas,
> i.e.
>
> A = [1 2 3];
>
> Now when you write
>
> B = [myfun (2)];
>
> it is interpreted as
>
> B = [myfun, (2)];
>
> Yes, this is silly, but if we want compatibility with Matlab, then we
> need this :-(
Silly indeed. I should have recalled that particular wrinkle in the
language and not been thrown off by pilot error. Personally, I always
try to separate my vector elements with commas but as long as the
language doesn't enforce commas I fear I may make this particular
mistake every once in a while.
I apologise again for wasting your time.
Regards,
--
Bård Skaflestad <address@hidden>
SINTEF ICT, Applied mathematics