Fri 18 Oct 2013 04:07:08 AM UTC, original submission:
Can there be a flag which removes all special cases in matrix return sizes?
In other words, if I say v = A(b), where b is a logical vector, the return type will always be a column vector, regardless of the dimensions of A (instead of being a row vector when A has vertical dimension 1).
Additionally, if v = A(i) where i is a double matrix/vector, v will always have the same dimensions as i, regardless of the dimension of A (instead of being a row vector when i has horiz. dimension 1 and v has vert. dimension 1)
And the find method, [i,j,v] = find(m) will always return column vectors for i, j, and v, even if m is a row vector.
When I'm trying to write Octave functions, I keep on having to deal with these special cases and they don't seem like they should be necessary.
For instance, if I write
[i,j] = find(m);
inds = [i,j]';
for b = inds
r = inds(1)
c = inds(2)
# Do something with r and c
endfor
This fails when m is a row vector, because i and j are made into row vectors and then inds ends up being a 2nx1 column vector instead of 2xn matrix as expected
It would be nice if I could turn off all these special case behaviors (even if it's not matlab compatible)
|