diff m-toolbox/classes/@ssm/doSetParameters.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@ssm/doSetParameters.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,25 @@
+% DOSETPARAMETERS Sets the values of the given parameters.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: DOSETPARAMETERS Sets the values of the given parameters.
+%
+% CALL:        obj = obj.setParameters({'key1', ...}, [val1, ...]);
+%              obj = obj.setParameters(plist);
+%              obj = obj.setParameters('key', val);
+%
+% VERSION: $Id: doSetParameters.m,v 1.2 2011/02/22 15:41:16 hewitson Exp $
+% 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function sys = doSetParameters(sys, setnames, setvalues)
+  Nset = numel(setvalues);
+  for j=1:Nset
+    if ~any(strcmpi(setnames{j}, {sys.params.params.key}))
+      warning(['### parameter named ' setnames{j} ' was not found in system ' sys.name])
+    else
+      sys.params.pset( setnames{j}, setvalues(j) );
+    end
+  end
+  
+end
+