


@info:
! @deftypefn {Function File} {@var{c} =} gt (@var{a},@var{b})
! @anchor{@dynDate/gt}
! @sp 1
! Overloads the gt (greater than) operator for the Dynare dates class (@ref{dynDate}).
! @sp 2
! @strong{Inputs}
! @sp 1
! @table @ @var
! @item a
! Dynare date object instantiated by @ref{dynDate}.
! @item b
! Dynare date object instantiated by @ref{dynDate}.
! @end table
! @sp 1
! @strong{Outputs}
! @sp 1
! @table @ @var
! @item c
! scalar integer equal to one if a>b, 0 otherwise.
! @end table
! @sp 2
! @strong{This function is called by:}
! @sp 2
! @strong{This function calls:}
!
! @end deftypefn
@eod:

0001 function c = gt(a,b) 0002 0003 %@info: 0004 %! @deftypefn {Function File} {@var{c} =} gt (@var{a},@var{b}) 0005 %! @anchor{@dynDate/gt} 0006 %! @sp 1 0007 %! Overloads the gt (greater than) operator for the Dynare dates class (@ref{dynDate}). 0008 %! @sp 2 0009 %! @strong{Inputs} 0010 %! @sp 1 0011 %! @table @ @var 0012 %! @item a 0013 %! Dynare date object instantiated by @ref{dynDate}. 0014 %! @item b 0015 %! Dynare date object instantiated by @ref{dynDate}. 0016 %! @end table 0017 %! @sp 1 0018 %! @strong{Outputs} 0019 %! @sp 1 0020 %! @table @ @var 0021 %! @item c 0022 %! scalar integer equal to one if a>b, 0 otherwise. 0023 %! @end table 0024 %! @sp 2 0025 %! @strong{This function is called by:} 0026 %! @sp 2 0027 %! @strong{This function calls:} 0028 %! 0029 %! @end deftypefn 0030 %@eod: 0031 0032 % Copyright (C) 2011 Dynare Team 0033 % stephane DOT adjemian AT univ DASH lemans DOT fr 0034 % 0035 % This file is part of Dynare. 0036 % 0037 % Dynare is free software: you can redistribute it and/or modify 0038 % it under the terms of the GNU General Public License as published by 0039 % the Free Software Foundation, either version 3 of the License, or 0040 % (at your option) any later version. 0041 % 0042 % Dynare is distributed in the hope that it will be useful, 0043 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0044 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0045 % GNU General Public License for more details. 0046 % 0047 % You should have received a copy of the GNU General Public License 0048 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0049 0050 verbose = 0; 0051 0052 if nargin~=2 0053 error('dynDate::eq: I need exactly two input arguments!') 0054 end 0055 0056 if ~( isa(a,'dynDate') && isa(b,'dynDate')) 0057 error(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDate objects!']) 0058 end 0059 0060 if verbose && a.freq~=b.freq 0061 error(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!']) 0062 end 0063 0064 if a.time(1)>b.time(1) 0065 c = 1; 0066 elseif isequal(a.time(1),b.time(1)) 0067 if a.time(2)>b.time(2) 0068 c = 1; 0069 else 0070 c = 0; 0071 end 0072 else 0073 c = 0; 0074 end 0075 0076 %@test:1 0077 %$ addpath ../matlab 0078 %$ 0079 %$ % Define some dates 0080 %$ date_1 = 1950; 0081 %$ date_2 = '1950Q2'; 0082 %$ date_3 = '1950Q3'; 0083 %$ date_4 = '1950Q1'; 0084 %$ date_5 = '1949Q2'; 0085 %$ 0086 %$ % Call the tested routine. 0087 %$ d1 = dynDate(date_1); 0088 %$ d2 = dynDate(date_2); 0089 %$ d3 = dynDate(date_3); 0090 %$ d4 = dynDate(date_4); 0091 %$ d5 = dynDate(date_5); 0092 %$ i1 = (d2>d3); 0093 %$ i2 = (d3>d4); 0094 %$ i3 = (d4>d2); 0095 %$ i4 = (d5>d4); 0096 %$ 0097 %$ % Check the results. 0098 %$ t(1) = dyn_assert(i1,0); 0099 %$ t(2) = dyn_assert(i2,1); 0100 %$ t(3) = dyn_assert(i3,0); 0101 %$ t(4) = dyn_assert(i4,0); 0102 %$ T = all(t); 0103 %@eof:1