diff scripts/optimization/optimset.m @ 8304:eeaee297c0da

modify optimset & implement optimget
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 31 Oct 2008 08:06:14 +0100
parents 93c65f2a5668
children 8833c0b18eb2
line wrap: on
line diff
--- a/scripts/optimization/optimset.m
+++ b/scripts/optimization/optimset.m
@@ -45,18 +45,16 @@
       tmp = opts';
       disp (struct (tmp{:}));
     else
-      ## Return structure with empty values.
-      t1 = opts(:,1)';
-      t2 = cell (size (t1));
-      tmp = [t1; t2];
-      retval = struct (tmp{:});
+      ## Return empty structure.
+      ## We're incompatible with Matlab at this point.
+      retval = struct ();
     endif
   elseif (nargs == 1 && ischar (varargin{1}))
     ## Return defaults for named function.
     fcn = varargin{1};
     optfcn = sprintf ("__%s_defopts__", fcn);
     if (exist (optfcn))
-      retval = optimset (optimset (), feval (optfcn));
+      retval = optimset (struct (), feval (optfcn));
     else
       error ("no defaults for function `%s'", fcn);
     endif
@@ -80,7 +78,7 @@
   elseif (rem (nargs, 2) == 0)
     ## Create struct.  Default values are replaced by those specified by
     ## name/value pairs.
-    retval = optimset (optimset (), struct (varargin{:}));
+    retval = optimset (struct (), struct (varargin{:}));
   else
     print_usage ();
   endif