


Copyright (C) 2002-2010 Dynare Team This file is part of Dynare. Dynare is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Dynare is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Dynare. If not, see <http://www.gnu.org/licenses/>.


0001 function dyntable(title,headers,labels,values,label_width,val_width, ... 0002 val_precis) 0003 0004 % Copyright (C) 2002-2010 Dynare Team 0005 % 0006 % This file is part of Dynare. 0007 % 0008 % Dynare is free software: you can redistribute it and/or modify 0009 % it under the terms of the GNU General Public License as published by 0010 % the Free Software Foundation, either version 3 of the License, or 0011 % (at your option) any later version. 0012 % 0013 % Dynare is distributed in the hope that it will be useful, 0014 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0016 % GNU General Public License for more details. 0017 % 0018 % You should have received a copy of the GNU General Public License 0019 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0020 0021 global options_ 0022 0023 if options_.noprint 0024 return 0025 end 0026 0027 %label_width = max(size(deblank(char(headers(1,:),labels)),2)+2, ... 0028 % label_width); 0029 label_width = max(size(deblank(char(headers(1,:),labels)),2))+2; 0030 0031 label_fmt = sprintf('%%-%ds',label_width); 0032 0033 values_length = max(ceil(max(max(log10(abs(values))))),1)+val_precis+1; 0034 if any(values) < 0 0035 values_length = values_length+1; 0036 end 0037 headers_length = max(size(deblank(headers(2:end,:)),2)); 0038 %val_width = max(values_length,val_width); 0039 val_width = max(headers_length,values_length)+2; 0040 %header_fmt = sprintf('%%-%ds',val_width); 0041 val_fmt = sprintf('%%%d.%df',val_width,val_precis); 0042 0043 headers_offset = 0; 0044 values_offset = 0; 0045 if headers_length > values_length 0046 % values_offset = ceil((val_width-values_length)/2); 0047 end 0048 0049 if length(title) > 0 0050 disp(sprintf('\n\n%s\n',title)); 0051 end 0052 if length(headers) > 0 0053 hh = sprintf(label_fmt,headers(1,:)); 0054 for i=2:size(headers,1) 0055 hla = size(deblank(headers(i,:)),2); 0056 hlb = ceil((val_width - hla)/2); 0057 hla = val_width - hla - hlb; 0058 hh = [hh char(32*ones(1,hlb)) deblank(headers(i,:)) ... 0059 char(32*ones(1,hla))]; 0060 end 0061 disp(hh); 0062 end 0063 for i=1:size(values,1) 0064 disp([sprintf(label_fmt,deblank(labels(i,:))) char(32*ones(1,values_offset)) sprintf(val_fmt,values(i,:))]); 0065 end 0066 0067 % 10/30/02 MJ