Thu 03 Nov 2016 10:44:46 PM UTC, comment #2:
Looking at the MATLAB behavior for these functions
so identity for "fft" and "mean", while empty matrix for "diff". However, Octave gives errors for each of those calls. Similar discrepancies are there for "mode", "median", and others. For the sake of compatibility, it would be good to copy this behavior. I would be willing to make the necessary changes if there is interest in changing this.
|
Wed 07 Sep 2016 03:00:36 PM UTC, comment #1:
If a function accepts a dimension greater than ndims, then it is probably done for Matlab compatibility.
Indeed, for example, Matlab's help for the max function states
> max returns A if dim is greater than ndims(A).
This is not the case for most functions and cannot really be solved in a general way. Since all arrays have ndims >= 2, 1 and 2 will always work, but dim >= 3 will only work if the array actually has ndims >= dim.
|
Wed 07 Sep 2016 08:55:53 AM UTC, original submission:
When DIM>=3 and size(X,DIM)==1, some functions work, such as "max", "min", "sum", "prod",
but some functions fail, such as "fft", "mean", "diff",
I'm not sure whether this is a bug or a feature,
although sometimes this is inconvenient and we have to make a workaround by "resize" or "postpad" X to make sure size(X,DIM)>=2 before calling these functions.
|