diff --git a/src/@x13/print.m b/src/@x13/print.m index a2aff33721003fd0b43b4dd2eca9c12021b59a00..794960c4fbc3e26fb9c390d20f82acce94f537d8 100644 --- a/src/@x13/print.m +++ b/src/@x13/print.m @@ -36,6 +36,9 @@ end fprintf(fid, 'series {\n'); fprintf(fid, ' title = "%s"\n', o.y.name{1}); printstart(fid, o.y.init); +p1 = firstobservedperiod(o.y); +p2 = lastobservedperiod(o.y); +printspan(fid, p1, p2); fprintf(fid, ' period = %i\n', o.y.init.freq); fprintf(fid, ' data = %s', sprintf(data2txt(o.y.data))); fprintf(fid, '}\n\n'); @@ -212,4 +215,6 @@ if ismember('x11', o.commands) end end fprintf(fid, '}\n\n'); -end \ No newline at end of file +end + +fclose(fid); \ No newline at end of file diff --git a/src/@x13/x13.m b/src/@x13/x13.m index 40fedeac04b37a7c5e86b238ef4cc5e4af90498a..466e76d6870fe27133661cb32f80b04fe5312ad8 100644 --- a/src/@x13/x13.m +++ b/src/@x13/x13.m @@ -73,6 +73,8 @@ classdef x13<handle % --*-- Unitary tests --*-- else error('x13:: Wrong input argument (a dseries object is expected)!') end + else + o.x = dseries(); end % Initialize other members (they are empty initially and must be set by calling methods) o.arima = setdefaultmember('arima'); diff --git a/src/utilities/x13/printspan.m b/src/utilities/x13/printspan.m new file mode 100644 index 0000000000000000000000000000000000000000..7bbcd5cd6c5a879f561a06741ee75cd746d8b535 --- /dev/null +++ b/src/utilities/x13/printspan.m @@ -0,0 +1,40 @@ +function printspan(fid, period1, period2) + +% Copyright (C) 2017 Dynare Team +% +% This code 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 dates submodule 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/>. + +if ~isequal(period1.freq, period2.freq) + error('x13:printspan: Second and third input argument must have common frequency!') +end + +if ~ismember(period1.freq, [1 4 12]) || ~ismember(period2.freq, [1 4 12]) + error('x13:printspan: Only monthly, quaterly or annual data are allowed!') +end + +if period1>=period2 + error('x13:printspan: Third argument has to be greater than the second argument!') +end + +switch period1.freq + case 12 + ListOfMonths = {'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'}; + fprintf(fid, ' span = (%i.%s, %i.%s)\n', period1.year, ListOfMonths{period1.subperiod}, period2.year, ListOfMonths{period2.subperiod}); + case 4 + fprintf(fid, ' span = (%i.%s, %i.%s)\n', period1.year, period1.subperiod, period2.year, period2.subperiod); + case 1 + fprintf(fid, ' span = (%i,%i)\n', period1.year, period2.year); + otherwise + error('x13:regression: This is a bug! Please contact the authors.') +end \ No newline at end of file