1function dsample(s1,s2) 2% function dsample(s1,s2) 3% This optional command permits to reduce the number of periods considered in following output commands. 4% If only one argument is provided, output is from period 1 to the period specified in the DSAMPLE command. 5% If two arguments are present output is done for the interval between the two periods. 6% DSAMPLE without arguments reset the sample to the one specified by PERIODS 7% 8% INPUTS 9% s1: first period 10% s2: last period 11% 12% OUTPUTS 13% none 14% 15% SPECIAL REQUIREMENTS 16% none 17 18% Copyright (C) 2001-2017 Dynare Team 19% 20% This file is part of Dynare. 21% 22% Dynare is free software: you can redistribute it and/or modify 23% it under the terms of the GNU General Public License as published by 24% the Free Software Foundation, either version 3 of the License, or 25% (at your option) any later version. 26% 27% Dynare is distributed in the hope that it will be useful, 28% but WITHOUT ANY WARRANTY; without even the implied warranty of 29% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30% GNU General Public License for more details. 31% 32% You should have received a copy of the GNU General Public License 33% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 34 35global options_ 36 37options_.smpl = zeros(2,1) ; 38 39if nargin == 0 40 options_.smpl(1) = 1 ; 41 options_.smpl(2) = options_.periods ; 42elseif nargin == 1 43 if s1 > options_.periods 44 error('DSAMPLE: argument greater than number of periods'); 45 end 46 options_.smpl(1) = 1 ; 47 options_.smpl(2) = s1 ; 48else 49 if s1 > options_.periods || s2 > options_.periods 50 error('DSAMPLE: one of the arguments is greater than number of periods'); 51 end 52 options_.smpl(1) = s1 ; 53 options_.smpl(2) = s2 ; 54end 55 56% 02/23/01 MJ added error checking