[Top][All Lists]

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

Make Octave behave more like Matlab

From: Matthias Brennwald
Subject: Make Octave behave more like Matlab
Date: Fri, 16 Feb 2007 20:46:23 +0100

Dear all

I use Octave to develop code that is intended to run on both Octave and Matlab. I found that Octave sometimes does things that Matlab won't. For example:

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

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.');
                disp('It is not red.');

My problem with this is that when I test my code with Octave, I don't get any errors or warnings, but then I get complaints from Matlab users because I wrote something that Matlab does not like. Is there a way to make Octave act more like Matlab?


Matthias Brennwald
L├Ągernstrasse 6
CH 8037 Z├╝rich
+41 (0)44 364 17 03

reply via email to

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