0001 function txt = display(t_span)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 txt = {};
0022
0023 for ii = 1:numel(t_span)
0024 t = t_span(ii);
0025
0026 b_banner = sprintf('---------- timespan %02d ----------', ii);
0027 txt{end+1} = b_banner;
0028 txt{end+1} = ' ';
0029
0030 fields = fieldnames(t);
0031 max_length = length(fields{1});
0032 for jj = 2:length(fields)
0033 if length(fields{jj}) > max_length
0034 max_length = length(fields{jj});
0035 end
0036 end
0037
0038 for jj = 1:length(fields)
0039 field = fields{jj};
0040
0041 str_field = [];
0042 str_field(1:max_length-length(field)) = ' ';
0043 str_field = [field str_field];
0044
0045
0046 if strcmp(field, 'created')
0047 txt{end+1} = ' ';
0048 end
0049
0050
0051 if isnumeric(t.(field))
0052 txt{end+1} = sprintf ('%s: %s',str_field, num2str(t.(field)));
0053
0054
0055 elseif ischar(t.(field))
0056 txt{end+1} = sprintf ('%s: %s',str_field, t.(field));
0057
0058
0059 elseif islogical(t.(field))
0060 if t.(field) == true
0061 txt{end+1} = sprintf ('%s: true',str_field);
0062 else
0063 txt{end+1} = sprintf ('%s: false',str_field);
0064 end
0065
0066
0067 elseif isobject(t.(field))
0068 if isa(t.(field), 'time') || isa(t.(field), 'timeformat')
0069 txt{end+1} = sprintf ('%s: %s',str_field, char(t.(field)));
0070 else
0071 txt{end+1} = sprintf ('%s: %s class',str_field, class(t.(field)));
0072 end
0073
0074
0075 elseif isjava(t.(field))
0076 if strcmp(class(t.(field)), 'sun.util.calendar.ZoneInfo')
0077 EE = java.text.SimpleDateFormat('Z');
0078 EE.setTimeZone(t.(field))
0079 zone_id = t.(field).getID;
0080 if strcmp(zone_id, 'UTC')
0081 txt{end+1} = sprintf ('%s: %s',str_field, char(t.(field).getID));
0082 else
0083 txt{end+1} = sprintf ('%s: %s (UTC%s)',str_field, char(t.(field).getID), char(EE.format(t_span.start.utc_epoch_milli)));
0084 end
0085 else
0086 error ('### Unknown java class %s', class(t.(field)))
0087 end
0088
0089 else
0090 error ('### Please define the output for this property %s', field)
0091 end
0092
0093 end
0094
0095
0096 e_banner(1:length(b_banner)) = '-';
0097 txt{end+1} = e_banner;
0098
0099 txt{end+1} = ' ';
0100 txt{end+1} = ' ';
0101
0102 end
0103
0104 if nargout == 0
0105 for ii=1:length(txt)
0106 disp(txt{ii});
0107 end
0108 end
0109
0110
0111
0112