Mercurial > hg > octave-nkf
changeset 13228:e8c52b442a99
Allow logical inputs to ismember() (Bug #33531).
* ismember.m: Validate inputs and convert logical inputs to numeric.
* validargs.m: Correct missing argument to error()
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 25 Sep 2011 22:03:45 -0700 |
parents | 9559417aa965 |
children | 983720941822 |
files | scripts/set/ismember.m scripts/set/private/validargs.m |
diffstat | 2 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/set/ismember.m +++ b/scripts/set/ismember.m @@ -77,6 +77,14 @@ print_usage (); endif + ## lookup() does not handle logical values + if (islogical (A)) + A = uint8 (A); + endif + if (islogical (s)) + s = uint8 (s); + endif + [A, s] = validargs ("ismember", A, s, varargin{:}); if (nargin == 2)
--- a/scripts/set/private/validargs.m +++ b/scripts/set/private/validargs.m @@ -37,12 +37,12 @@ elseif (nargin == 4) if (strcmpi (byrows_arg, "rows")) if (iscell (x) || iscell (y)) - error ("%s: cells not supported with ""rows"""); + error ('%s: cells not supported with "rows"', caller); elseif (! (ismatrix (x) && ismatrix (y))) error ("%s: input arguments must be arrays or cell arrays of strings", caller); else if (ndims (x) > 2 || ndims (y) > 2) - error ("%s: need 2-dimensional matrices for ""rows""", caller); + error ('%s: need 2-dimensional matrices for "rows"', caller); elseif (columns (x) != columns (y) && ! (isempty (x) || isempty (y))) error ("%s: number of columns must match", caller); endif