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