|Subject:||Matlab compatibility or not Matlab compatibility|
|Date:||Fri, 12 Feb 2016 16:22:50 +0100|
|User-agent:||Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.2.0|
I would like to hear your opinion on the following issue.
Context : I am preparing a patch for bugs #43925 and #44498.
The point is to ensure that size-related functions (isscalar, isvector, ismatrix...) respect the result provided by the "size" function, even when it has been overloaded for a user-defined class.
This is a both a Matlab compatibility issue (and there are already several xtests for this in tests/classes/classes.tst) and a regression (the behaviour was correct (1) in 3.8.2).
My question is about ndims. It turns out that Matlab behaves in a different way for this specific function : the documentation says that ndims returns "the length of the size vector of the array",
but I have a very simple user-defined class for which size(x) always returns [3 4 5] and still ndims(x) returns 2.
In my opinion this should be considered as a bug in Matlab (I have tested on Matlab R2012a and R2015a, I haven't access to R2015b right now)... but I would like to hear what others think.
(1) for some functions at least, such as isscalar, isvector and ismatrix... I haven't checked the others.
|[Prev in Thread]||Current Thread||[Next in Thread]|