diff --git a/matlab/reports/@report_table/write.m b/matlab/reports/@report_table/write.m index 38e57c3ef53ce8a7c68506e4d2fd2ba184443696..6f2d023d9ecf23f11e4d2e43cf98706e7cdfcb8a 100644 --- a/matlab/reports/@report_table/write.m +++ b/matlab/reports/@report_table/write.m @@ -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