view examples/code/funcdemo.cc @ 28216:f5644ccd1df5

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.
author Rik <rik@octave.org>
date Mon, 13 Apr 2020 18:19:41 -0700
parents d7e4d9b383ff
children
line wrap: on
line source

#include <octave/oct.h>
#include <octave/parse.h>

DEFMETHOD_DLD (funcdemo, interp, args, nargout, "Function Demo")
{
  int nargin = args.length ();

  if (nargin < 2)
    print_usage ();

  octave_value_list newargs;

  for (octave_idx_type i = nargin - 1; i > 0; i--)
    newargs(i-1) = args(i);

  octave_value_list retval;

  if (args(0).is_function_handle () || args(0).is_inline_function ()
      || args(0).is_string ())
    retval = interp.feval (args(0), newargs, nargout);
  else
    error ("funcdemo: INPUT must be string, inline, or function handle");

  return retval;
}