Rewrote @dynDates::eq method so that it handles correctly objects with only one element.

time-shift
Stéphane Adjemian (Charybdis) 2013-10-10 15:52:50 +02:00
parent 74d7bcbc71
commit 21fa2b949d
1 changed files with 9 additions and 6 deletions

View File

@ -41,7 +41,7 @@ function C = eq(A,B) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if nargin~=2
if ~isequal(nargin,2)
error('dynDates::eq: I need exactly two input arguments!')
end
@ -54,13 +54,16 @@ if ~isequal(A.freq,B.freq)
return
end
if ~isequal(A.ndat,B.ndat)
C = 0;
return
if isequal(A.ndat, B.ndat)
C = isequal(A.time, B.time);
else
if isequal(A.ndat,1) || isequal(B.ndat,1)
C = transpose(all(transpose(bsxfun(@eq,A.time,B.time))));
else
C = 0;
end
end
C = isequal(A.time,B.time);
%@test:1
%$ % Define some dynDates objects
%$ d1 = dynDate('1950Q1'):dynDate('1959Q4') ;