help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unexpected syntax error in Octave 3.2.2


From: Søren Hauberg
Subject: Re: Unexpected syntax error in Octave 3.2.2
Date: Mon, 26 Apr 2010 14:08:58 -0700

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 :-(

Søren



reply via email to

[Prev in Thread] Current Thread [Next in Thread]