[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string-arrays - different behavior of{} in Win2000 and debian linux
From: |
TAltman |
Subject: |
Re: string-arrays - different behavior of{} in Win2000 and debian linux |
Date: |
Thu, 13 Nov 2003 17:52:52 -0800 |
This observed behavior is due to Octave's cell literals requiring a comma
between elements. If memory serves, adding commas in won't break your Matlab
script(s), because in analogy to array literals, the comma delimiter is
optional ( please correct me if I'm wrong ).
Thanks,
~Tomer Altman
----- Original Message -----
From: "Dmitri A. Sergatskov" <address@hidden>
Date: Thursday, November 13, 2003 5:24 pm
Subject: Re: string-arrays - different behavior of{} in Win2000 and debian
linux
> John W. Eaton wrote:
> ...
> > index the cell array with {}. As far as I know, the only kind of
> > object that has ever allowed indexing with {} is a cell array.
>
> May be this is not what I am thinking, but it seems Matlab
> can do that. E.g. the following function works fine w/ Matlab,
> but bombs in Octave:
>
> ------------------
> function yesno(x)
> switch x
> case {1 'yes'}
> disp('Yes!')
> case {0 'no'}
> disp('No!')
> otherwise
> disp('Wrong!')
> end
> ----------------
>
>
> < M A T L A B >
> Copyright 1984-2002 The MathWorks, Inc.
> Version 6.5.0.180913a Release 13
> Jun 18 2002
>
> ...
>
> >> yesno(1)
> Yes!
> >> yesno('yes')
> Yes!
> >> yesno('Yes')
> Wrong!
> >> yesno('no')
> No!
> >> yesno(0)
> No!
>
> ----------------
> GNU Octave, version 2.1.50 (i686-pc-linux-gnu).
> Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 John
> W. Eaton.
> ....
>
> octave:1> yesno (1)
> parse error near line 3 of file
> /tumbleweed/dima/analysis/octave/yesno.m
> >>> case {1 'yes'}
> ^
>
> error: `yesno' undefined near line 1 column 1
>
> --
> Sincerely,
>
> Dmitri.
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
>
>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------