0001 function txt = display(tt, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 VERSION = '$Id: display.html,v 1.12 2008/03/31 10:27:44 hewitson Exp $';
0022 CATEGORY = 'Output';
0023
0024
0025 if nargin == 2
0026 if isa(tt, 'timeformat') && ischar(varargin{1})
0027 in = char(varargin{1});
0028 if strcmp(in, 'Params')
0029 txt = plist();
0030 return
0031 elseif strcmp(in, 'Version')
0032 txt = VERSION;
0033 return
0034 elseif strcmp(in, 'Category')
0035 txt = CATEGORY;
0036 return
0037 end
0038 end
0039 end
0040
0041 txt = {};
0042
0043 for ii = 1:numel(tt)
0044 t = tt(ii);
0045
0046 b_banner = sprintf('---------- timeformat %02d ----------', ii);
0047 txt{end+1} = b_banner;
0048 txt{end+1} = ' ';
0049
0050 fields = fieldnames(t);
0051 max_length = length(fields{1});
0052 for jj = 2:length(fields)
0053 if length(fields{jj}) > max_length
0054 max_length = length(fields{jj});
0055 end
0056 end
0057
0058 for jj = 1:length(fields)
0059 field = fields{jj};
0060
0061 str_field = [];
0062 str_field(1:max_length-length(field)) = ' ';
0063 str_field = [field str_field];
0064
0065
0066 if isnumeric(t.(field))
0067 txt{end+1} = sprintf ('%s: %s',str_field, num2str(t.(field)));
0068
0069
0070 elseif ischar(t.(field))
0071 txt{end+1} = sprintf ('%s: %s',str_field, t.(field));
0072
0073
0074 elseif islogical(t.(field))
0075 if t.(field) == true
0076 txt{end+1} = sprintf ('%s: true',str_field);
0077 else
0078 txt{end+1} = sprintf ('%s: false',str_field);
0079 end
0080
0081
0082 elseif isobject(t.(field))
0083 txt{end+1} = sprintf ('%s: %s class',str_field, class(t.(field)));
0084
0085
0086 elseif isjava(t.(field))
0087 error ('### Unknown java class %s', class(t.(field)))
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