view m-toolbox/classes/@ssm/doSetParameters.m @ 12:86aabb42dd84 database-connection-manager

Use utils.repository utilities
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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