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