1 #include <octave/oct.h>
2 
3 DEFUN_DLD (paramdemo, args, nargout, "Parameter Check Demo")
4 {
5   if (args.length () != 1)
6     print_usage ();
7 
8   NDArray m = args(0).array_value ();
9 
10   double min_val = -10.0;
11   double max_val = 10.0;
12 
13   octave_stdout << "Properties of input array:\n";
14 
15   if (m.any_element_is_negative ())
16     octave_stdout << "  includes negative values\n";
17 
18   if (m.any_element_is_inf_or_nan ())
19     octave_stdout << "  includes Inf or NaN values\n";
20 
21   if (m.any_element_not_one_or_zero ())
22     octave_stdout << "  includes other values than 1 and 0\n";
23 
24   if (m.all_elements_are_int_or_inf_or_nan ())
25     octave_stdout << "  includes only int, Inf or NaN values\n";
26 
27   if (m.all_integers (min_val, max_val))
28     octave_stdout << "  includes only integers in [-10,10]\n";
29 
30   return octave_value_list ();
31 }
32