SETENDT Set the property 'endT'. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Set the property 'endT'. CALL: obj = obj.setEndT('new endT'); obj = obj.setEndT(plist('endT', 'new endT')); obj = setEndT(obj, 'new endT'); INPUTS: obj - can be a vector, matrix, list, or a mix of them. pl - to set the endT with a plist specify only one plist with only one key-word 'endT'. M-FILE INFO: Get information about this methods by calling >> timespan.getInfo('setEndT') Get information about a specified set-plist by calling: >> timespan.getInfo('setEndT', 'None') VERSION: $Id: setEndT.m,v 1.2 2008/09/04 15:29:31 ingo Exp $ HISTORY: 27-05-2008 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % SETENDT Set the property 'endT'. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: Set the property 'endT'. 0005 % 0006 % CALL: obj = obj.setEndT('new endT'); 0007 % obj = obj.setEndT(plist('endT', 'new endT')); 0008 % obj = setEndT(obj, 'new endT'); 0009 % 0010 % INPUTS: obj - can be a vector, matrix, list, or a mix of them. 0011 % pl - to set the endT with a plist specify only one plist with 0012 % only one key-word 'endT'. 0013 % 0014 % M-FILE INFO: Get information about this methods by calling 0015 % >> timespan.getInfo('setEndT') 0016 % 0017 % Get information about a specified set-plist by calling: 0018 % >> timespan.getInfo('setEndT', 'None') 0019 % 0020 % VERSION: $Id: setEndT.m,v 1.2 2008/09/04 15:29:31 ingo Exp $ 0021 % 0022 % HISTORY: 27-05-2008 Diepholz 0023 % Creation 0024 % 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 0027 function varargout = setEndT(varargin) 0028 0029 %%% Check if this is a call for parameters 0030 if utils.helper.isinfocall(varargin{:}) 0031 varargout{1} = getInfo(varargin{3}); 0032 return 0033 end 0034 0035 %%% Internal call: Only one object + don't look for a plist 0036 if strcmp(varargin{end}, 'internal') 0037 0038 %%% decide whether we modify the timespan-object, or create a new one. 0039 varargin{1} = copy(varargin{1}, nargout); 0040 0041 %%% If the time is a string then convert the string into a time-object. 0042 tt = varargin{2}; 0043 if ischar(tt) 0044 tt = time(tt); 0045 end 0046 0047 varargin{1}.endT = tt; 0048 varargin{1}.setTimeformat(tt.timeformat); 0049 objs(ii).computeInterval; 0050 varargout{1} = varargin{1}; 0051 return 0052 end 0053 0054 %%% Normal call: 0055 [objs, invars, rest] = utils.helper.collect_objects(varargin(:), 'timespan'); 0056 [pls, invars, rest] = utils.helper.collect_objects(rest(:), 'plist'); 0057 0058 endT = rest; 0059 0060 if length(endT) ~=1 0061 0062 if length(pls) == 1 0063 endT = {}; 0064 if nparams(pls) == 1 && isparam(pls, 'endT') 0065 0066 %%% If the plist contains only one parameter with the key-word 'endT' 0067 %%% then set 'endT' to the value in the timespan object. 0068 endT{1} = find(pls, 'endT'); 0069 0070 else 0071 endT{1} = pls; 0072 end 0073 elseif length(pls) > 1 0074 error('### To set the ''endT'' please specify only one plist') 0075 else 0076 error('### Please specify [only one] value.') 0077 end 0078 end 0079 0080 %%% Set the endT 0081 for ii = 1:numel(objs) 0082 %%% decide whether we modify the timespan-object, or create a new one. 0083 objs(ii) = copy(objs(ii), nargout); 0084 0085 %%% If the time is a string then convert the string into a time-object. 0086 tt = varargin{2}; 0087 if ischar(tt) 0088 tt = time(tt); 0089 end 0090 0091 objs(ii).endT = tt; 0092 objs(ii).setTimeformat(tt.timeformat); 0093 objs(ii).addHistory(getInfo, plist('endT', tt), [], objs(ii).hist); 0094 objs(ii).computeInterval; 0095 end 0096 0097 %%% Prepare output 0098 varargout{1} = objs; 0099 0100 end 0101 0102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0103 % Local Functions % 0104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0105 0106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0107 % 0108 % FUNCTION: getInfo 0109 % 0110 % DESCRIPTION: Get Info Object 0111 % 0112 % HISTORY: 11-07-07 M Hewitson 0113 % Creation. 0114 % 0115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0116 0117 function ii = getInfo(varargin) 0118 if nargin == 1 && strcmpi(varargin{1}, 'None') 0119 sets = {}; 0120 pl = []; 0121 else 0122 sets = {'Default'}; 0123 pl = getDefaultPlist; 0124 end 0125 % Build info object 0126 ii = minfo(mfilename, 'timespan', '', utils.const.categories.helper, '$Id: setEndT.m,v 1.2 2008/09/04 15:29:31 ingo Exp $', sets, pl); 0127 end 0128 0129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0130 % 0131 % FUNCTION: getDefaultPlist 0132 % 0133 % DESCRIPTION: Get Default Plist 0134 % 0135 % HISTORY: 11-07-07 M Hewitson 0136 % Creation. 0137 % 0138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0139 0140 function plo = getDefaultPlist() 0141 plo = plist('endT', ''); 0142 end 0143