reporting: support monthly data in table

remove-priordens
Houtan Bastani 2014-01-03 16:04:39 +01:00
parent 0678b98eca
commit ce6fa17483
1 changed files with 22 additions and 1 deletions

View File

@ -133,7 +133,28 @@ switch dates.freq
end
end
case 12
error('@report_table.write: weekly dates not yet implemented');
thdr{1, 2} = datedata(:, 2)';
if size(thdr, 1) > 1
for i=2:size(thdr, 1)
split = find(thdr{i-1, 2} == 12, 1, 'first');
assert(~isempty(split), '@report_table.write 2: Shouldn''t arrive here');
thdr{i, 2} = thdr{i-1, 2}(split+1:end);
thdr{i-1, 2} = thdr{i-1, 2}(1:split);
end
end
for i=1:size(thdr, 1)
fprintf(fid, ' & \\multicolumn{%d}{c}{%d}', size(thdr{i,2}, 2), thdr{i,1});
end
for i=1:length(rhscols)
fprintf(fid, ' & %s', rhscols{i});
end
fprintf(fid, '\\\\\\cline{%d-%d}%%\n', nlhc+1, ncols);
for i=1:size(thdr, 1)
months = thdr{i, 2};
for j=1:size(months, 2)
fprintf(fid, ' & \\multicolumn{1}{c}{M%d}', months(j));
end
end
otherwise
error('@report_table.write: invalid dseries frequency');
end