classdef Array
properties
data = [1 2 3];
end
methods
function ind = end(obj, k, n)
ind = length(obj.data) - k;
end
end
end
A=Array(), if we do A(end) and breakpoint into out = length..., we'll see k=1, yet docs say
A(end-1)
is same as A(ind), where
ind = end(A,1,1)
so A(end) should be same as end(A,0,1)? In fact k=1 also with end-1, end-9 and any other.
For my purpose where I override subsref I simply set ind = length(obj.data) and it works, so it appears as if end is treated as constant and e.g. end - 1 is processed later, but this seems against docs.