# HG changeset patch # User Colin Macdonald # Date 1454309948 28800 # Node ID 5ecdcc6320d904a388bb8e69238bdb771d4e90fa # Parent 5f62b5dae8b1ce004923e34457b5eae5dcdd4563 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. diff -r 5f62b5dae8b1 -r 5ecdcc6320d9 scripts/general/interp2.m --- 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 interp2 ({1}) %!error interp2 (1,1,1) %!error interp2 (ones (2,2,2)) diff -r 5f62b5dae8b1 -r 5ecdcc6320d9 scripts/plot/draw/isosurface.m --- 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]); +