[Top][All Lists]

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

Re: Built-in function for `switch'

From: Guido Dietz
Subject: Re: Built-in function for `switch'
Date: Fri, 28 Feb 1997 11:44:11 +0100

 On Fri, 28 Feb 1997 01:35:57 -0600 you, "John W. Eaton", wrote:
> No.  I have considered adding something like this, but probably with a
> syntax that matches the current language a little better, maybe using 
> switch and endswitch keywords.
> For now, you have to use if/elseif/else/endif.
> I believe that the MathWorks web site mentions that MATLAB 5 supports
> a switch statement.  Does anyone know what syntax it uses?

This is an Xtract from the manual:
switch var
        case 1
        case {2,3,4}                % < This is a Cell Array (new feature)
                disp('2 or 3 or 4');
        case 5
                disp('something else');
NOTE: Unlike C switch does not 'fall through'!

BTW what's about multidimensional arrays ;-? Would that be too hard to

> Thanks,
> jwe


            Guido Dietz                   Email:    address@hidden
Aerodynamisches Institut der RWTH-Aachen  WWW:
      Wuellnerstr. zw. 5 u. 7             Ftp:
      D-52062 Aachen, Germany   Phone: +49-241-80-5426 Fax: +49-241-8888-257
It is always preferable to visit home with a friend.  Your parents will
not be pleased with this plan, because they want you all to themselves
and because in the presence of your friend, they will have to act like
mature human beings ...
                -- Playboy, January 1983

reply via email to

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