help-octave
[Top][All Lists]
Advanced

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

Re: string-arrays - different behavior of{} in Win2000 and debian linux


From: Dmitri A. Sergatskov
Subject: Re: string-arrays - different behavior of{} in Win2000 and debian linux
Date: Thu, 13 Nov 2003 18:24:41 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1

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



reply via email to

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