FORMAT Returns the time in specified format. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: FORMAT Returns the time in specified format. CALL: string = format(tt, format_str); string = format(tt, 'HH:MM:SS'); M-FILE INFO: Get information about this methods by calling >> time.getInfo('format') Get information about a specified set-plist by calling: >> time.getInfo('format', 'set') VERSION: $Id: format.m,v 1.11 2008/09/04 15:29:31 ingo Exp $ HISTORY: 23-07-2007 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % FORMAT Returns the time in specified format. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: FORMAT Returns the time in specified format. 0005 % 0006 % CALL: string = format(tt, format_str); 0007 % string = format(tt, 'HH:MM:SS'); 0008 % 0009 % M-FILE INFO: Get information about this methods by calling 0010 % >> time.getInfo('format') 0011 % 0012 % Get information about a specified set-plist by calling: 0013 % >> time.getInfo('format', 'set') 0014 % 0015 % VERSION: $Id: format.m,v 1.11 2008/09/04 15:29:31 ingo Exp $ 0016 % 0017 % HISTORY: 23-07-2007 Diepholz 0018 % Creation 0019 % 0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0021 0022 function varargout = format(varargin) 0023 0024 %%% Check if this is a call for parameters 0025 if utils.helper.isinfocall(varargin{:}) 0026 varargout{1} = getInfo(varargin{3}); 0027 return 0028 end 0029 0030 % Collect all time-objects 0031 [tt, invars, rest] = utils.helper.collect_objects(varargin(:), 'time'); 0032 0033 if isempty(rest) 0034 format_str = tt(1).timeformat; 0035 else 0036 format_str = rest{1}; 0037 end 0038 0039 tt = tt.setTimeformat(format_str); 0040 0041 varargout{1} = char(tt); 0042 end 0043 0044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0045 % Local Functions % 0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0047 0048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0049 % 0050 % FUNCTION: getInfo 0051 % 0052 % DESCRIPTION: Get Info Object 0053 % 0054 % HISTORY: 11-07-07 M Hewitson 0055 % Creation. 0056 % 0057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0058 0059 function ii = getInfo(varargin) 0060 if nargin == 1 && strcmpi(varargin{1}, 'None') 0061 sets = {}; 0062 pl = []; 0063 else 0064 sets = {'Default'}; 0065 pl = getDefaultPlist; 0066 end 0067 % Build info object 0068 ii = minfo(mfilename, 'time', '', utils.const.categories.output, '$Id: format.m,v 1.11 2008/09/04 15:29:31 ingo Exp $', sets, pl); 0069 end 0070 0071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0072 % 0073 % FUNCTION: getDefaultPlist 0074 % 0075 % DESCRIPTION: Get Default Plist 0076 % 0077 % HISTORY: 11-07-07 M Hewitson 0078 % Creation. 0079 % 0080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0081 0082 function plo = getDefaultPlist() 0083 plo = plist(); 0084 end 0085