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