# HG changeset patch # User Rik # Date 1586827181 25200 # Node ID f5644ccd1df5c5eb0c828f012fd8408e162063d8 # Parent ad71b30058ff8fe8390b5dda4343d3338a7b0019 griddata.m, griddatan.m: Small tweak in input validation. * griddata.m: Only call tolower on METHOD input when it is required. * griddatan.m: Only call tolower on METHOD input when it is required. Add note to documentation that query values outside the convex hull will return NaN. diff -r ad71b30058ff -r f5644ccd1df5 scripts/geometry/griddata.m --- a/scripts/geometry/griddata.m Mon Apr 13 18:10:45 2020 -0700 +++ b/scripts/geometry/griddata.m Mon Apr 13 18:19:41 2020 -0700 @@ -129,8 +129,9 @@ method = "linear"; elseif (! ischar (method)) error ("griddata: METHOD must be a string"); + else + method = tolower (method); endif - method = tolower (method); if (any (strcmp (method, {"linear", "nearest", "v4"}))) ## Do nothing, these are implemented methods diff -r ad71b30058ff -r f5644ccd1df5 scripts/geometry/griddatan.m --- a/scripts/geometry/griddatan.m Mon Apr 13 18:10:45 2020 -0700 +++ b/scripts/geometry/griddatan.m Mon Apr 13 18:19:41 2020 -0700 @@ -74,8 +74,10 @@ ## @end example ## ## Programming Notes: If the input is complex the real and imaginary parts -## are interpolated separately. For 2-D and 3-D data additional interpolation -## methods are available by using the @code{griddata} function. +## are interpolated separately. Interpolation is based on a Delaunay +## triangulation and any query values outside the convex hull of the input +## points will return @code{NaN}. For 2-D and 3-D data additional +## interpolation methods are available by using the @code{griddata} function. ## @seealso{griddata, griddata3, delaunayn} ## @end deftypefn @@ -103,9 +105,10 @@ method = "linear"; elseif (! ischar (method)) error ("griddatan: METHOD must be a string"); + else + method = tolower (method); endif - method = tolower (method); if (strcmp (method, "linear") || strcmp (method, "nearest")) ## Do nothing, these are implemented methods elseif (strcmp (method, "v4"))