[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can we deprecate/remove extra arguments currently accepted by numel?
From: |
John W. Eaton |
Subject: |
Can we deprecate/remove extra arguments currently accepted by numel? |
Date: |
Fri, 15 Mar 2019 00:34:59 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 |
Octave's numel function accepts extra arguments:
octave:1> help numel
'numel' is a built-in function from the file libinterp/corefcn/data.cc
-- numel (A)
-- numel (A, IDX1, IDX2, ...)
Return the number of elements in the object A.
Optionally, if indices IDX1, IDX2, ... are supplied, return the
number of elements that would result from the indexing
A(IDX1, IDX2, ...)
Note that the indices do not have to be scalar numbers. For
example,
A = 1;
B = ones (2, 3);
numel (A, B)
will return 6, as this is the number of ways to index with B. Or
the index could be the string ":" which represents the colon
operator. For example,
A = ones (5, 3);
numel (A, 2, ":")
will return 3 as the second row has three column entries.
This method is also called when an object appears as lvalue with
cs-list indexing, i.e., 'object{...}' or 'object(...).field'.
Does Matlab still accept this usage? It does not appear to be
documented now. There is a question on Matlab Central about it here:
https://www.mathworks.com/matlabcentral/answers/169310-what-does-2nd-argument-mean-in-numel-function
that indicates that it was documented around 5-6 years ago. I didn't
find anything in the release notes
(https://www.mathworks.com/help/matlab/release-notes.html) about it
being removed.
Is the function numArgumentsFromSubsctript somehow related to this
(apparently obsolete) way of calling numel?
If it is not needed in Matlab, do we need it in Octave? Does any code
in Octave rely on it now? Can we safely remove it now, or should we
deprecate/warn for a couple of releases first?
If you think this is not enough questions, I can probably find a way to
ask more.
jwe
- Can we deprecate/remove extra arguments currently accepted by numel?,
John W. Eaton <=