|
From: | Randy Gober |
Subject: | Minor MATLAB/Octave logical incompatibility |
Date: | Sun, 5 Sep 2004 15:58:07 -0500 |
Looking at the online MATLAB documentation for the logical command, I noticed this tidbit:
"Most arithmetic operations remove the logicalness from an array. For example, adding zero to a logical array removes its logical characteristic. A = +A is the easiest way to convert a logical array, A, to a numeric double array."
(From http://www.mathworks.com/access/helpdesk/help/techdoc/ref/logical.html)
However, Octave keeps the type as bool in this case, in the just realest 2.1.58, we have:
octave:1> A=logical(eye(3));
octave:2> islogical(A)
ans = 1
octave:3> A=+A;
octave:4> islogical(A)
ans = 1
octave:5> islogical(eye(3))
ans = 0
(also verified using 'whos')
I am not sure if this is a bug or a feature, but it is different from the way MATLAB does it.
[Prev in Thread] | Current Thread | [Next in Thread] |