0001 function DBDisplay(results)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 CheckMyM;
0029
0030 if nargin < 1,
0031 error('Incorrect number of parameters (type ''help <a href="matlab:help DBDisplay">DBDisplay</a>'' for details).');
0032 end
0033
0034 if ~isfield(results,'eid') || ~isfield(results,'name'),
0035 error('Incorrect query results (type ''help <a href="matlab:help DBDisplay">DBDisplay</a>'' for details).');
0036 end
0037
0038
0039
0040
0041 title1 = 'EID';
0042 title2 = 'NAME';
0043 if isempty(results.eid),
0044 width1 = 0;
0045 width2 = 0;
0046 else
0047 width1 = max(cellfun(@length,results.eid));
0048 width2 = max(cellfun(@length,results.name));
0049 end
0050 width1 = max([width1 length(title1)]);
0051 width2 = max([width2 length(title2)]);
0052 spacing = ' ';
0053 total = width1+width2+3*length(spacing);
0054
0055 disp(' ');
0056 disp(repmat('=',1,total));
0057 disp([spacing sprintf(['%-' int2str(width1) 's%s%-' int2str(width2) 's'],'EID',spacing,'NAME')]);
0058 disp(repmat('-',1,total'));
0059
0060 for i = 1:length(results.eid),
0061 disp([spacing sprintf(['%-' int2str(width1) 's%s%-' int2str(width2) 's'],results.eid{i},spacing,results.name{i})]);
0062 end
0063
0064 disp(repmat('=',1,total'));
0065 disp(' ');