TIMESPAN timespan object class constructor. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: TIMESPAN timespan object class constructor. Create a timespan object. PROPERTIES: start - Start time of the time span. (type: time class) end - End time of the time span. (type: time class) timeformat - The time format of start- AND end- time. timezone - The timezone of start- AND end- time. CONSTRUCTORS: t_span = timespan() t_span = timespan( time, time) t_span = timespan(time, '14:00:05') t_span = timespan('14:00:00', time) t_span = timespan('14:00:00', '14:00:05') t_span = timespan('14:00:00', '14:00:05', 'HH:MM:SS') t_span = timespan(plist) Parameter sets for plist constructor (in order of priority): From XML File ------------- Construct an TIMESPAN by loading it from an XML file. 'filename' - construct an TIMESPAN from a filename. Example: plist('filename', 'ts1.xml') [default: empty string] From MAT File ------------- Construct an TIMESPAN by loading it from a MAT file. 'filename' - construct an TIMESPAN from a filename. Example: plist('filename', 'ts1.mat') [default: empty string] From Repository --------------- Construct an TIMESPAN by retrieving it from an LTPDA repository. 'Hostname' - the repository hostname. Only those objects which are TIMESPANs are returned. [default: 'localhost']; Additional parameters: 'Database' - The database name [default: 'ltpda'] 'ID' - A vector of object IDs. [default: []] From Timespan Definition ------------------------ Construct an TIMESPAN by its properties definition 'start' - the starting time [default: '1970-01-01 00:30:00.000']; 'end' - the ending time [default: '1980-01-01 12:00:00.010']; The times can be as a time-object, a string or a unix time Example 1: plist('start', time, 'stop', '2008-12-31 23:59:59') Example 2: plist('start', '2007-12-31 23:59:59', 'stop', 1206442503406) Additional parameters: 'timezone' - Timezone (string or java object) [default: 'UTC'] 'timeformat' - Time format (string) [default: 'yyyy-mm-dd HH:MM:SS.FFF'] From Plist ---------- 'Plist' - construct from a plist. The value passed should be a plist object. [default: empty plist] VERSION: $Id: timespan.html,v 1.12 2008/03/31 10:27:39 hewitson Exp $ HISTORY: 23-07-2007 Diepholz Creation The following call returns a parameter list object that contains the default parameter values: >> pl = timespan(timespan,'Params') The following call returns a string that contains the routine CVS version: >> version = timespan(timespan,'Version') The following call returns a string that contains the routine category: >> category = timespan(timespan,'Category') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = timespan(varargin) 0002 % TIMESPAN timespan object class constructor. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: TIMESPAN timespan object class constructor. 0007 % Create a timespan object. 0008 % 0009 % PROPERTIES: start - Start time of the time span. (type: time class) 0010 % end - End time of the time span. (type: time class) 0011 % timeformat - The time format of start- AND end- time. 0012 % timezone - The timezone of start- AND end- time. 0013 % 0014 % CONSTRUCTORS: t_span = timespan() 0015 % t_span = timespan( time, time) 0016 % t_span = timespan(time, '14:00:05') 0017 % t_span = timespan('14:00:00', time) 0018 % t_span = timespan('14:00:00', '14:00:05') 0019 % t_span = timespan('14:00:00', '14:00:05', 'HH:MM:SS') 0020 % t_span = timespan(plist) 0021 % 0022 % Parameter sets for plist constructor (in order of priority): 0023 % 0024 % From XML File 0025 % ------------- 0026 % 0027 % Construct an TIMESPAN by loading it from an XML file. 0028 % 0029 % 'filename' - construct an TIMESPAN from a filename. 0030 % Example: plist('filename', 'ts1.xml') 0031 % [default: empty string] 0032 % 0033 % 0034 % From MAT File 0035 % ------------- 0036 % 0037 % Construct an TIMESPAN by loading it from a MAT file. 0038 % 0039 % 'filename' - construct an TIMESPAN from a filename. 0040 % Example: plist('filename', 'ts1.mat') 0041 % [default: empty string] 0042 % 0043 % 0044 % From Repository 0045 % --------------- 0046 % 0047 % Construct an TIMESPAN by retrieving it from an LTPDA repository. 0048 % 0049 % 'Hostname' - the repository hostname. Only those objects which 0050 % are TIMESPANs are returned. 0051 % [default: 'localhost']; 0052 % 0053 % Additional parameters: 0054 % 0055 % 'Database' - The database name [default: 'ltpda'] 0056 % 'ID' - A vector of object IDs. [default: []] 0057 % 0058 % 0059 % From Timespan Definition 0060 % ------------------------ 0061 % Construct an TIMESPAN by its properties definition 0062 % 'start' - the starting time [default: '1970-01-01 00:30:00.000']; 0063 % 'end' - the ending time [default: '1980-01-01 12:00:00.010']; 0064 % The times can be as a time-object, a string or a unix time 0065 % Example 1: plist('start', time, 'stop', '2008-12-31 23:59:59') 0066 % Example 2: plist('start', '2007-12-31 23:59:59', 'stop', 1206442503406) 0067 % 0068 % Additional parameters: 0069 % 0070 % 'timezone' - Timezone (string or java object) [default: 'UTC'] 0071 % 'timeformat' - Time format (string) [default: 'yyyy-mm-dd HH:MM:SS.FFF'] 0072 % 0073 % 0074 % From Plist 0075 % ---------- 0076 % 0077 % 'Plist' - construct from a plist. The value passed should be a plist 0078 % object. 0079 % [default: empty plist] 0080 % 0081 % VERSION: $Id: timespan.html,v 1.12 2008/03/31 10:27:39 hewitson Exp $ 0082 % 0083 % HISTORY: 23-07-2007 Diepholz 0084 % Creation 0085 % 0086 % The following call returns a parameter list object that contains the 0087 % default parameter values: 0088 % 0089 % >> pl = timespan(timespan,'Params') 0090 % 0091 % The following call returns a string that contains the routine CVS version: 0092 % 0093 % >> version = timespan(timespan,'Version') 0094 % 0095 % The following call returns a string that contains the routine category: 0096 % 0097 % >> category = timespan(timespan,'Category') 0098 % 0099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0100 0101 ALGONAME = mfilename; 0102 VERSION = '$Id: timespan.html,v 1.12 2008/03/31 10:27:39 hewitson Exp $'; 0103 CATEGORY = 'Constructor'; 0104 0105 %% Check if this is a special call: 0106 % default parameter list, cvs-version, category 0107 if (nargin == 2 || nargin == 3) && isa(varargin{1}, 'timespan') && ischar(varargin{2}) 0108 in = char(varargin{2}); 0109 if strcmp(in, 'Params') 0110 if nargin == 2 0111 varargout{1} = getDefaultPlist(); 0112 else 0113 varargout{1} = getDefaultPlist(varargin{3}); 0114 end 0115 return 0116 elseif strcmp(in, 'Version') 0117 varargout{1} = VERSION; 0118 return 0119 elseif strcmp(in, 'Category') 0120 varargout{1} = CATEGORY; 0121 return 0122 end 0123 end 0124 0125 0126 %% %%%%%%%%%%%%%%%%%%%%%%%%% Create time object %%%%%%%%%%%%%%%%%%%%%%%% 0127 0128 switch nargin 0129 0130 case 0 0131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0132 %%% No Parameters %%% 0133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0134 0135 %%%%%%%%%% t_span = timespan() %%%%%%%%%% 0136 0137 t_span = init(VERSION); 0138 0139 case 1 0140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0141 %%% One Parameter %%% 0142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0143 0144 %%%%%%%%%% t1 = timespan(timespan-object) %%%%%%%%%% 0145 % Duplicate input timespan object 0146 if isa(varargin{1}, 'timespan') 0147 0148 t_span = varargin{1}; 0149 0150 elseif ischar(varargin{1}) 0151 0152 %%%%%%%%%% tf = timespan('foo.mat') %%%%%%%%%% 0153 %%%%%%%%%% tf = timespan('foo.xml') %%%%%%%%%% 0154 % Filename constructor 0155 filename = varargin{1}; 0156 [path, name, ext, vers] = fileparts(filename); 0157 switch ext 0158 case '.mat' 0159 t_span = load(filename); 0160 t_span = t_span.a; 0161 case '.xml' 0162 root_node = xmlread(filename); 0163 t_span = ltpda_xmlread(root_node, 'timespan'); 0164 otherwise 0165 error('### Unknown file type.'); 0166 end 0167 0168 elseif isa(varargin{1}, 'plist') 0169 %%%%%%%%%% t1 = time(plist) %%%%%%%%%% 0170 % Parameter list 0171 0172 pl = varargin{1}; 0173 0174 filename = find(pl, 'filename'); 0175 hostname = find(pl, 'hostname'); 0176 ipl = find(pl, 'plist'); 0177 t_start = find(pl, 'start'); 0178 t_end = find(pl, 'end'); 0179 0180 % Selection of construction method 0181 if ~isempty(filename) 0182 0183 %----------------------------------------------------- 0184 %--- Construct from file 0185 %----------------------------------------------------- 0186 [path, name, ext, vers] = fileparts(filename); 0187 switch ext 0188 case '.mat' 0189 % Do a filename constructor 0190 t_span = load(filename); 0191 t_span = t_span.a; 0192 t_span.plist = pl; 0193 case '.xml' 0194 % Do a filename constructor 0195 root_node = xmlread(filename); 0196 t_span = ltpda_xmlread(root_node, 'timespan'); 0197 t_span.plist = pl; 0198 otherwise 0199 error('### Unknown file type.'); 0200 end 0201 0202 elseif ~isempty(hostname) 0203 0204 %----------------------------------------------------- 0205 %--- Construct from repository 0206 %----------------------------------------------------- 0207 0208 % do hostname constructor 0209 t_span = timespanFromRepository(pl, VERSION, ALGONAME); 0210 t_span.plist = remove(pl, 'conn'); 0211 0212 elseif ~isempty(t_start) && ~isempty(t_end) 0213 0214 %----------------------------------------------------- 0215 %--- Construct from start and end times 0216 %----------------------------------------------------- 0217 t_span = timespanFromTimes(pl, VERSION, ALGONAME); 0218 0219 elseif ~isempty(ipl) 0220 0221 %----------------------------------------------------- 0222 %--- Construct from plist 0223 %----------------------------------------------------- 0224 0225 % if the plist is empty, we return the default time object 0226 if nparams(ipl) == 0 0227 t_span = init(VERSION); 0228 t_span.plist = ipl; 0229 else 0230 % do plist constructor 0231 t_span = timespan(ipl); 0232 end 0233 0234 else 0235 0236 %----------------------------------------------------- 0237 %--- ERROR 0238 %----------------------------------------------------- 0239 0240 %% if the plist is empty then return the default time object 0241 if nparams(pl) == 0 0242 t_span = init(VERSION); 0243 t_span.plist = pl; 0244 else 0245 error('### Unknown TIMESPAN constructor method.'); 0246 end 0247 end 0248 0249 %%%%%%%%%% t1 = time(struct) %%%%%%%%%% 0250 % Struct constructor 0251 elseif isstruct(varargin{1}) 0252 0253 t_span = init(VERSION); 0254 0255 fields = fieldnames(varargin{1}); 0256 for ii = 1:length(fields) 0257 field = fields{ii}; 0258 %%% start -> time-object 0259 if strcmp(field, 'start') 0260 start_t = varargin{1}.start; 0261 if isstruct(start_t) 0262 start_t = time(start_t); 0263 end 0264 t_span.start = start_t; 0265 %%% end -> time-object 0266 elseif strcmp(field, 'end') 0267 end_t = varargin{1}.end; 0268 if isstruct(end_t) 0269 end_t = time(end_t); 0270 end 0271 t_span.end = end_t; 0272 %%% timeformat -> timeformat-object 0273 elseif strcmp(field, 'timeformat') 0274 tf = varargin{1}.timeformat; 0275 if isstruct(tf) 0276 tf = timeformat(tf); 0277 end 0278 t_span.timeformat = tf; 0279 %%% All other 0280 else 0281 try 0282 t_span.(field) = varargin{1}.(field); 0283 catch 0284 error('### The field ''%s'' in the struct is not a timespan property.', field) 0285 end 0286 end 0287 end 0288 0289 else 0290 error ('### Unknown constructor'); 0291 end 0292 0293 case 2 0294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0295 %%% Two Parameter %%% 0296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0297 0298 if ischar(varargin{1}) && ischar(varargin{2}) 0299 %%%%%%%%%% t_span = timespan('14:00:00', '14:00:05') %%%%%%%%%% 0300 0301 t_span = init(VERSION); 0302 t_span.start = time(varargin{1}); 0303 t_span.end = time(varargin{2}); 0304 0305 % Adjust the 'timeformat' AND the 'timezone' of the end time to the start time. 0306 t_span = set(t_span, 'timeformat', t_span.start.timeformat); 0307 t_span = set(t_span, 'timezone', t_span.start.timezone); 0308 0309 % Compute the interval 0310 t_span = compute_interval(t_span); 0311 0312 elseif isa(varargin{1}, 'database') 0313 %%%%%%%%%% f = timespan(database, IDs) %%%%%%%%%% 0314 % From DATABASE 0315 0316 t_span = retrieve(varargin{1}, varargin{2:end}); 0317 0318 elseif isa(varargin{1}, 'time') && isa(varargin{2}, 'time') 0319 %%%%%%%%%% t_span = timespan(time, time) %%%%%%%%%% 0320 0321 t_span = init(VERSION); 0322 t_span.start = varargin{1}; 0323 t_span.end = varargin{2}; 0324 0325 % Adjust the 'timeformat' AND the 'timezone' of the end time to the start time. 0326 t_span = set(t_span, 'timeformat', t_span.start.timeformat); 0327 t_span = set(t_span, 'timezone', t_span.start.timezone); 0328 0329 % Compute the interval 0330 t_span = compute_interval(t_span); 0331 0332 elseif isa(varargin{1}, 'time') && ischar(varargin{2}) 0333 %%%%%%%%%% t_span = timespan(time, '14:00:05') %%%%%%%%%% 0334 0335 t_span = init(VERSION); 0336 t_span.start = varargin{1}; 0337 t_span.end = time(varargin{2}, char(t_span.start.timeformat)); 0338 0339 % Adjust the 'timeformat' AND the 'timezone' of the end time to the start time. 0340 t_span = set(t_span, 'timeformat', t_span.start.timeformat); 0341 t_span = set(t_span, 'timezone', t_span.start.timezone); 0342 0343 % Compute the interval 0344 t_span = compute_interval(t_span); 0345 0346 elseif ischar(varargin{1}) && isa(varargin{2}, 'time') 0347 %%%%%%%%%% t_span = timespan('14:00:00', time) %%%%%%%%%% 0348 0349 t_span = init(VERSION); 0350 t_span.end = varargin{2}; 0351 t_span.start = time(varargin{1}, char(t_span.end.timeformat)); 0352 0353 % Adjust the 'timeformat' AND the 'timezone' of the end time to the start time. 0354 t_span = set(t_span, 'timeformat', t_span.start.timeformat); 0355 t_span = set(t_span, 'timezone', t_span.start.timezone); 0356 0357 % Compute the interval 0358 t_span = compute_interval(t_span); 0359 0360 else 0361 error (' ### Unknown constructor.'); 0362 0363 end 0364 0365 case 3 0366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0367 %%% Three Parameter %%% 0368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0369 0370 if ischar(varargin{1}) && ischar(varargin{2}) && ischar(varargin{3}) 0371 %%%%%%%%%% t_span = timespan('14:00:00', '14:00:05', 'HH:MM:SS') %%%%%%%%%% 0372 0373 t_span = init(VERSION); 0374 t_span.start = time(varargin{1}, varargin{3}); 0375 t_span.end = time(varargin{2}, varargin{3}); 0376 t_span.timeformat = t_span.start.timeformat; 0377 0378 % Compute the interval 0379 t_span = compute_interval(t_span); 0380 0381 elseif isa(varargin{1}, 'time') && isa(varargin{2}, 'time') && isa(varargin{3}, 'timeformat') 0382 %%%%%%%%%% t_span = timespan('14:00:00', '14:00:05', timeformat) %%%%%%%%%% 0383 0384 t_span = init(VERSION); 0385 t_span.start = varargin{1}; 0386 t_span.end = varargin{2}; 0387 t_span.timeformat = varargin{3}; 0388 0389 t_span.start = set(t_span.start, 'timeformat', t_span.timeformat); 0390 t_span.end = set(t_span.end, 'timeformat', t_span.timeformat); 0391 0392 % Compute the interval 0393 t_span = compute_interval(t_span); 0394 0395 else 0396 error (' ### Unknown constructor.'); 0397 0398 end 0399 0400 otherwise 0401 0402 error ('### Unknown number of inputs'); 0403 0404 end 0405 0406 % Consistency check 0407 if t_span.start.utc_epoch_milli > t_span.end.utc_epoch_milli 0408 error('### The start time is larger than the end time.'); 0409 end 0410 0411 varargout{1} = t_span; 0412 0413 end % function varargout = timespan(varargin) 0414 0415 %% Helper functions 0416 0417 0418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0419 % 0420 % FUNCTION: timespanFromTimes 0421 % 0422 % DESCRIPTION: Construct an time from a millisec value 0423 % 0424 % CALL: ts = timespanFromTimes(pli, version, algoname); 0425 % 0426 % PARAMETER: pli: Parameter list object 0427 % version: cvs version string 0428 % algoname: The m-file name (use the mfilename command) 0429 % 0430 % 0431 % HISTORY: 25-03-2008 M Hueller 0432 % Creation 0433 % 0434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0435 function ts = timespanFromTimes(pli, version, algoname) 0436 0437 % Add default values 0438 pl = combine(pli, getDefaultPlist('From Timespan Definition')); 0439 0440 ts = init(version); 0441 0442 pl_timeformat = find(pl, 'timeformat'); 0443 format_nr = str2double(pl_timeformat); 0444 if isnumeric(format_nr) && ~isnan(format_nr) 0445 ts = set(ts, 'timeformat', format_nr); 0446 else 0447 ts = set(ts, 'timeformat', pl_timeformat); 0448 end 0449 0450 ts = set(ts, 'timezone', find(pl, 'timezone')); 0451 0452 ts = set(ts, 'start', time(find(pl, 'start'))); 0453 ts = set(ts, 'end', time(find(pl, 'end'))); 0454 0455 0456 ts.plist = pli; 0457 0458 end % function ts = timespanFromTimes(pli, version, algoname); 0459 0460 0461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0462 % 0463 % FUNCTION: timespanFromRepository 0464 % 0465 % DESCRIPTION: Construct an timespan from a repository 0466 % 0467 % CALL: t = timespanFromRepository(pli, version, algoname) 0468 % 0469 % PARAMETER: pli: Parameter list object 0470 % version: cvs version string 0471 % algoname: The m-file name (use the mfilename command) 0472 % 0473 % HISTORY: 22-03-2008 M Hewitson 0474 % Creation 0475 % 0476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0477 function ts = timespanFromRepository(pli, version, algoname) 0478 0479 % Add default values 0480 pl = combine(pli, getDefaultPlist('From Repository')); 0481 0482 % Get parameters 0483 conn = find(pl, 'conn'); 0484 hostname = find(pl, 'hostname'); 0485 database = find(pl, 'database'); 0486 ids = find(pl, 'id'); 0487 0488 % do we have a connection? 0489 closeConn = 0; 0490 if isempty(conn) 0491 closeConn = 1; 0492 % Connect to repository 0493 conn = mysql_connect(hostname, database); 0494 end 0495 if ~isa(conn, 'database') 0496 error('### connection failed.'); 0497 end 0498 0499 % Get each ID 0500 Nids = length(ids); 0501 ts = []; 0502 for kk=1:Nids 0503 0504 %---- This id 0505 id = ids(kk); 0506 disp(sprintf(' - retrieving ID %d', id)); 0507 0508 %---- check ID object type 0509 tt = mysql_getObjType(conn, id); 0510 %---- If this is a timespan 0511 if strcmp(tt, mfilename) 0512 %---- call database constructor 0513 a = ltpda_obj_retrieve(conn, id); 0514 %---- Add history 0515 %---- Add to output array 0516 ts = [ts a]; 0517 else 0518 warning(' !skipping ID %d, type %s', id, tt); 0519 end 0520 0521 end 0522 0523 % close connection 0524 if closeConn 0525 close(conn); 0526 end 0527 0528 end % function ts = timespanFromRepository(pli, version, algoname) 0529 0530 0531 %%%%%%%%%%%%%%%%%%%%%%%%% define timespan properties %%%%%%%%%%%%%%%%%% 0532 0533 function t_span = init(version) 0534 t_span.name = 'None'; 0535 t_span.start = time(); 0536 t_span.end = time(); 0537 t_span.timeformat = t_span.start.timeformat; 0538 t_span.interval = ''; 0539 t_span.timezone = t_span.start.timezone; 0540 t_span.created = time(); 0541 t_span.version = version; 0542 t_span.plist = plist; 0543 t_span = class (t_span, 'timespan'); 0544 end % function t_span = init(version) 0545 0546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0547 % 0548 % FUNCTION: getDefaultPlist 0549 % 0550 % DESCRIPTION: Default Parameter Lists 0551 % 0552 % CALL: out = getDefaultPlist(set-string) 0553 % 0554 % PARAMETER: set-string: A string which defines the default parameter list. 0555 % 0556 % HISTORY: 11-02-2008 M Hueller 0557 % Creation 0558 % 0559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0560 function out = getDefaultPlist(varargin) 0561 0562 % list of available parameter sets 0563 sets = {'From XML File', 'From MAT File', ... 0564 'From Repository', ... 0565 'From Timespan Definition', ... 0566 'From Plist'}; 0567 0568 if nargin == 0 0569 out = sets; 0570 return 0571 end 0572 0573 set = varargin{1}; 0574 switch set 0575 %------------------------------------------ 0576 %--- Repository constructor 0577 %------------------------------------------ 0578 case 'From Repository' 0579 out = plist('hostname', 'localhost', 'database', 'ltpda', 'ID', []); 0580 0581 %------------------------------------------ 0582 %--- From definition constructor 0583 %------------------------------------------ 0584 case 'From Timespan Definition' 0585 out = plist('start', '1970-01-01 00:30:00.000', ... 0586 'end', '1980-01-01 12:00:00.010', .... 0587 'timezone', 'UTC', ... 0588 'timeformat', 'yyyy-mm-dd HH:MM:SS.FFF'); 0589 0590 %------------------------------------------ 0591 %--- Read from XML file 0592 %------------------------------------------ 0593 case 'From XML File' 0594 out = plist('filename', ''); 0595 0596 %------------------------------------------ 0597 %--- Read from MAT file 0598 %------------------------------------------ 0599 case 'From MAT File' 0600 out = plist('filename', ''); 0601 0602 %------------------------------------------ 0603 %--- Create from a plist 0604 %------------------------------------------ 0605 case 'From Plist' 0606 out = plist('Plist', []); 0607 0608 otherwise 0609 out = plist(); 0610 end 0611 0612 end 0613 0614