[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Colon inconsistency between Matlab and Octave
From: |
Arno Peters |
Subject: |
Colon inconsistency between Matlab and Octave |
Date: |
Thu, 28 Jan 1999 01:28:51 +0100 (CET) |
SUMMARY:
1) In Matlab, the colon operator _always_ returns a column vector.
2) pause flushes buffers in Matlab, not in Octave
Verified with Octave version 2.1.10 and 2.0.13.
Case 1:
octave> a = [1 2; 3 4];
octave> a(:)
ans =
1
3
2
4
Case 2:
octave> b = [1; 2; 3; 4];
octave> b(:)
ans =
1
2
3
4
Case 3:
octave> c = [1 2 3 4];
octave> c(:)
ans =
1 2 3 4
Cases 1 and 2 are consistent with Matlab but for case 3 the results
should be identical to case 2. I guess I would expect this also from
looking at the behaviour of the colon operator on matrixes.
Currently I am unable to verify with Matlab but I have seen at least
one script that relies on this feature: robot, a set of scripts in the
contributed directory of the Matlab site. The Robot Toolbox homepage
is at
http://www.cat.csiro.au/dmt/programs/autom/pic/matlab.html
Contrary what the author claims in the documentation, the demo runs
perfectly except for this minor incompatibility. BTW, he used Matlab
version 4 and Octave version 1.1.1. Things have changed considerably
since then (1996).
At least options 2 and 3 of 'rtdemo' will bomb out after you hit one
or more keys. This way, I also found out that apparently 'pause' will
flush the buffers in Matlab. When you run the other demos will also
make this clear because in Octave you don't see a thing until you hit
a key or several keys.
Thanks for any feedback you can provide.
--
Arno Peters
- Colon inconsistency between Matlab and Octave,
Arno Peters <=