[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make Octave behave more like Matlab
From: 
Matthias Brennwald 
Subject: 
Re: Make Octave behave more like Matlab 
Date: 
Fri, 16 Feb 2007 21:29:32 +0100 
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