Home > FMAToolbox > Database > private > DBDisplay.m

DBDisplay

PURPOSE ^

DBDisplay - Display results of a database query.

SYNOPSIS ^

function DBDisplay(results)

DESCRIPTION ^

DBDisplay - Display results of a database query.

  USAGE

    DBDisplay(results)

    results        output of <a href="matlab:help DBGetFigures">DBGetFigures</a> or <a href="matlab:help DBGetFigures">DBGetVariables</a>

  EXAMPLE

    DBDisplay(DBGetVariables('name="Spectrogram",'output','info'));

  SEE

    See also DBGetVariables, DBGetFigures.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function DBDisplay(results)
0002 
0003 %DBDisplay - Display results of a database query.
0004 %
0005 %  USAGE
0006 %
0007 %    DBDisplay(results)
0008 %
0009 %    results        output of <a href="matlab:help DBGetFigures">DBGetFigures</a> or <a href="matlab:help DBGetFigures">DBGetVariables</a>
0010 %
0011 %  EXAMPLE
0012 %
0013 %    DBDisplay(DBGetVariables('name="Spectrogram",'output','info'));
0014 %
0015 %  SEE
0016 %
0017 %    See also DBGetVariables, DBGetFigures.
0018 %
0019 
0020 % Copyright (C) 2007-2013 by Michaƫl Zugaro
0021 %
0022 % This program is free software; you can redistribute it and/or modify
0023 % it under the terms of the GNU General Public License as published by
0024 % the Free Software Foundation; either version 3 of the License, or
0025 % (at your option) any later version.
0026 
0027 % Make sure MyM is installed and functional
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 % Display
0039 
0040 % Column widths
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 % Print header
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 % Print rows
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 % Print footer
0064 disp(repmat('=',1,total'));
0065 disp(' ');

Generated on Fri 16-Mar-2018 13:00:20 by m2html © 2005