0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 function varargout = modify(varargin)
0034
0035
0036 utils.helper.msg(utils.const.msg.MNAME, ['running ', mfilename]);
0037
0038
0039 if utils.helper.isinfocall(varargin{:})
0040 varargout{1} = getInfo(varargin{3});
0041 return
0042 end
0043
0044
0045 if ~nargin==2, error('wrong number of inputs!'), end
0046
0047 if ~isequal(class(varargin{1}),'ssm'), error(['argument is not a ssm but a ', class(varargin{1})]),end
0048 if ~isequal(class(varargin{2}),'plist'), error(['argument is not a plist but a ', class(varargin{2})]),end
0049
0050 sys = varargin{1};
0051 options = varargin{2};
0052 Nsys = length(sys);
0053 Noptions = length(options);
0054
0055
0056
0057 if Noptions==1
0058 sys_out(:,1) = reshape(sys,Nsys,1);
0059 else
0060 for j=1:Noptions
0061 sys_out(:,j)=copy(reshape(sys,Nsys,1),true);
0062 end
0063 end
0064
0065 for i_sys=1:Nsys
0066 for i_options=1:Noptions
0067 commands = find(options(i_options), 'commands');
0068 for i_commands=1:length(commands)
0069 strng = ['sys_out(i_sys,i_options).', commands{i_commands}];
0070 utils.helper.msg(utils.const.msg.MNAME, 'executing command: ');
0071 utils.helper.msg(utils.const.msg.MNAME, strng);
0072 eval(strng);
0073 end
0074 sys_out(i_sys,i_options) = validate(sys_out(i_sys,i_options));
0075 sys_out(i_sys,i_options).addHistory(ssm.getInfo(mfilename), options(i_options) , {''}, sys(i_sys).hist );
0076 end
0077 end
0078 varargout = {sys_out};
0079 end
0080
0081
0082 function ii = getInfo(varargin)
0083 if nargin == 1 && strcmpi(varargin{1}, 'None')
0084 sets = {};
0085 pls = [];
0086 elseif nargin == 1 && ~isempty(varargin{1}) && ischar(varargin{1})
0087 sets{1} = varargin{1};
0088 pls = getDefaultPlist(sets{1});
0089 else
0090 sets = {'Default'};
0091 pls = [];
0092 for kk=1:numel(sets)
0093 pls = [pls getDefaultPlist(sets{kk})];
0094 end
0095 end
0096
0097 ii = minfo(mfilename, 'ssm', '', 'STATESPACE', '$Id: resp.m,v 1.17 2008/07/22 10:22:38 ingo Exp $', sets, pls);
0098 end
0099
0100 function plo = getDefaultPlist(set)
0101 switch set
0102 case 'Default'
0103 plo = plist( 'commands', {'=ssm;'});
0104 otherwise
0105 error('### Unknown parameter set [%s].', set);
0106 end
0107 end
0108