changeset 10610:2bbb6ce00a70 octave-forge

control-devel: improve argument checking
author paramaniac
date Wed, 01 Aug 2012 15:45:50 +0000
parents 4f47a76d5195
children 46edf90675ae
files extra/control-devel/inst/__slicot_identification__.m
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/extra/control-devel/inst/__slicot_identification__.m	Tue Jul 31 15:34:36 2012 +0000
+++ b/extra/control-devel/inst/__slicot_identification__.m	Wed Aug 01 15:45:50 2012 +0000
@@ -72,7 +72,7 @@
   conct = 1;                            # no connection between experiments
   ctrl = 1;                             # don't confirm order n
   rcond = 0.0;
-  tol = -1.0; % 0;
+  tol = -1.0;
   s = [];
   n = [];
   conf = [];
@@ -83,16 +83,27 @@
     key = lower (varargin{k});
     val = varargin{k+1};
     switch (key)
-      ## TODO: proper argument checking
       case {"n", "order"}
+        if (! issample (val, 0) || val != round (val))
+          error ("%s: 'n' must be a positive integer", method);
+        endif
         n = val;
       case "s"
+        if (! issample (val, 0) || val != round (val))
+          error ("%s: 's' must be a positive integer", method);
+        endif
         s = val;
       case {"alg", "algorithm"}
         error ("alg");
       case "tol"
+        if (! is_real_scalar (val))
+          error ("%s: tolerance 'tol' must be a real scalar", method);
+        endif
         tol = val;
       case "rcond"
+        if (! is_real_scalar (val))
+          error ("%s: 'rcond' must be a real scalar", method);
+        endif
         rcond = val;
       case "confirm"
         conf = logical (val);