Do you know what version of Matlab is being used? I'm using 7.3 and it
does not require commas after case statements (nor can I recall any
version that did since I started using it):
>>version
ans =
7.3.0.298 (R2006b)
>> color = 'green';
>> switch color
case 'red'
disp('It is not red.');
otherwise
disp('It is not red.');
end
It is not red.
As for the quotes issue, why not use single quotes in octave?
Paul
On 2/16/07, Matthias Brennwald <address@hidden> wrote:
>
> On 16.02.2007, at 21:22, John W. Eaton wrote:
>
> > | 1. Strings can be defined with single or double quotes in Octave,
> > | while Matlab only accepts single quotes. For instance, this will
> > work
> > | in Octave, but not in Matlab:
> > |
> > | myString = "Hello";
> >
> > Have you reported this bug to the MathWorks?
>
> Uhm, no, mainly this is no bug. My above comment is just plain wrong.
>
> But: the below example with the switch / case statements won't work
> in Matlab if the single quotes are replaced by double quotes (Octave
> does not care). I hope this time I'm right -- I can't test because I
> don't have Matlab at the moment. I'm just forwarding the comments I
> received from a Matlab user).
>
> > | 2. switch / case statements: Matlab requires a comma after the case
> > | statements, Octave doesn't. For instance, the following will work in
> > | Octave, but not in Matlab (which requires commas after 'red' and
> > | otherwse):
> > |
> > | color = 'green';
> > | switch color
> > | case 'red'
> > | disp('It is red.');
> > | otherwise
> > | disp('It is not red.');
> > | end
>
> Matthias
>
>
>
>
> -------
> Matthias Brennwald
> Lägernstrasse 6
> CH 8037 Zürich
> +41 (0)44 364 17 03
> address@hidden
>
>
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>