3 ms·
In and of itself, it's not wrong. Where it goes sideways is how Matlab chooses to allow matrix operations against these 1x1 matrices that should otherwise fail,
by 3JPLW 7y ago
In and of itself, it's not wrong. Where it goes sideways is how Matlab chooses to allow matrix operations against these 1x1 matrices that should otherwise fail, how Matlab chooses to iterate (over columns, unless it's a "row-vector"), and how Matlab chooses to define length (the max dimension).
Amusingly this also leads to things like
x = 1
x(end+1) = 2
x == [1 2]
- tnecniv 7y agoI don't see how any of those behaviors are wrong. It's just a standard that MATLAB elects to follow.