comparison scripts/general/interpn.m @ 8116:6c69f5cda32b

For for extrapval in interpn
author Kris Thielemans
date Thu, 18 Sep 2008 10:46:24 -0400
parents 4fbaba9abec1
children fa78cb8d8a5c
comparison
equal deleted inserted replaced
8115:37c1bdb9805c 8116:6c69f5cda32b
53 ## throughout the curve. 53 ## throughout the curve.
54 ## @end table 54 ## @end table
55 ## 55 ##
56 ## The default method is 'linear'. 56 ## The default method is 'linear'.
57 ## 57 ##
58 ## If @var{extrap} is the string 'extrap', then extrapolate values beyond 58 ## If @var{extrapval} is the scalar value, use it to replace the values
59 ## the endpoints. If @var{extrap} is a number, replace values beyond the 59 ## beyond the endpoints with that number. If @var{extrapval} is missing,
60 ## endpoints with that number. If @var{extrap} is missing, assume NA. 60 ## assume NA.
61 ## @seealso{interp1, interp2, spline, ndgrid} 61 ## @seealso{interp1, interp2, spline, ndgrid}
62 ## @end deftypefn 62 ## @end deftypefn
63 63
64 function vi = interpn (varargin) 64 function vi = interpn (varargin)
65 65
77 elseif (ischar (varargin{end - 1})) 77 elseif (ischar (varargin{end - 1}))
78 if (! isnumeric (varargin{end}) || ! isscalar (varargin{end})) 78 if (! isnumeric (varargin{end}) || ! isscalar (varargin{end}))
79 error ("extrapal is expected to be a numeric scalar"); 79 error ("extrapal is expected to be a numeric scalar");
80 endif 80 endif
81 method = varargin{end - 1}; 81 method = varargin{end - 1};
82 extrapval = varargin{end};
82 nargs = nargs - 2; 83 nargs = nargs - 2;
83 endif 84 endif
84 85
85 if (nargs < 3) 86 if (nargs < 3)
86 v = varargin{1}; 87 v = varargin{1};