Mercurial > hg > ltpda
diff m-toolbox/classes/@time/string.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@time/string.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,30 @@ +% STRING writes a command string that can be used to recreate the input time object. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: STRING writes a command string that can be used to recreate the +% input time object. +% +% CALL: cmd = string(time-object); +% +% VERSION: $Id: string.m,v 1.13 2011/02/18 16:48:55 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function cmd = string(varargin) + + % collect the time-objects + tt = [varargin{:}]; + + cmd = ''; + for jj=1:length(tt) + pl = plist('milliseconds', tt(jj).utc_epoch_milli); + cmd = [cmd 'time(' string(pl) ') ']; + end + + % if the there are more than one object wrap the command with brackets + if numel(tt) > 1 + cmd = ['[' cmd(1:end-1) ']']; + end + +end +