Mercurial > octave
changeset 21173:5ecdcc6320d9 stable
Fix regressions caused by ismatrix definition change (partial fix bug #47036).
Replace ismatrix with calls to isnumeric where appropriate.
Add test for isosurface regression. In interp2, ismatrix is
correct but ndims check unnecessary.
* interp2.m: Remove unneccessary check on ndims when ismatrix used.
Clean up indentation.
* isosurface.m: Replace ismatrix with isnumeric. Add BIST test.
author | Colin Macdonald <cbm@m.fsf.org> |
---|---|
date | Sun, 31 Jan 2016 22:59:08 -0800 |
parents | 5f62b5dae8b1 |
children | 3be6a07e8bad 5cff92d32ee7 |
files | scripts/general/interp2.m scripts/plot/draw/isosurface.m |
diffstat | 2 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/interp2.m Sun Jan 31 21:05:08 2016 -0800 +++ b/scripts/general/interp2.m Sun Jan 31 22:59:08 2016 -0800 @@ -1,4 +1,4 @@ -## Copyright (C) 2000-2015 Kai Habel +## Copyright (C) 2000-2016 Kai Habel ## Copyright (C) 2009 Jaroslav Hajek ## ## This file is part of Octave. @@ -105,7 +105,7 @@ method(1) = []; endif method = validatestring (method, ... - {"nearest", "linear", "pchip", "cubic", "spline"}); + {"nearest", "linear", "pchip", "cubic", "spline"}); ## Read numeric input switch (nargs) @@ -123,7 +123,7 @@ endswitch ## Type checking - if (! isnumeric (Z) || isscalar (Z) || ! ismatrix (Z) || ndims (Z) != 2) + if (! isnumeric (Z) || isscalar (Z) || ! ismatrix (Z)) error ("interp2: Z must be a 2-D matrix"); endif if (! isempty (n) && ! (isscalar (n) && n >= 0 && n == fix (n))) @@ -563,8 +563,8 @@ %!assert (interp2 (z, [2 3 1], [2 2 2], "spline"), [5 7 3], tol) ## Test input validation -%!error interp2 (1, 1, 1, 1, 1, 2) #only 5 numeric inputs -%!error interp2 (1, 1, 1, 1, 1, 2, 2) #only 5 numeric inputs +%!error interp2 (1, 1, 1, 1, 1, 2) # only 5 numeric inputs +%!error interp2 (1, 1, 1, 1, 1, 2, 2) # only 5 numeric inputs %!error <Z must be a 2-D matrix> interp2 ({1}) %!error <Z must be a 2-D matrix> interp2 (1,1,1) %!error <Z must be a 2-D matrix> interp2 (ones (2,2,2))
--- a/scripts/plot/draw/isosurface.m Sun Jan 31 21:05:08 2016 -0800 +++ b/scripts/plot/draw/isosurface.m Sun Jan 31 22:59:08 2016 -0800 @@ -1,4 +1,4 @@ -## Copyright (C) 2009-2015 Martin Helm +## Copyright (C) 2009-2016 Martin Helm ## ## This file is part of Octave. ## @@ -145,7 +145,7 @@ [n2, n1, n3] = size (val); [x, y, z] = meshgrid (1:n1, 1:n2, 1:n3); iso = varargin{2}; - if (nargin >= 3 && ismatrix (varargin{3})) + if (nargin >= 3 && isnumeric (varargin{3})) colors = varargin{3}; calc_colors = true; endif @@ -232,3 +232,9 @@ %! assert (size (v), [3 3]); %! assert (size (c), [3 1]); +%!test +%! [f, v, c] = isosurface (val, .3, y); +%! assert (size (f), [1 3]); +%! assert (size (v), [3 3]); +%! assert (size (c), [3 1]); +