From 41d10eb1f2cc71eab35a5495c49044ff775f087e Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Thu, 6 Apr 2017 16:13:28 +0200 Subject: [PATCH] fix bug with firstobservedperiod. closes #18 (cherry picked from commit 6b17c3de353d7202d4b47b7cc437063f4d542ad3) --- src/@dseries/firstobservedperiod.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/@dseries/firstobservedperiod.m b/src/@dseries/firstobservedperiod.m index fa5d6a2..92c1b23 100644 --- a/src/@dseries/firstobservedperiod.m +++ b/src/@dseries/firstobservedperiod.m @@ -8,7 +8,7 @@ function d = firstobservedperiod(o) % --*-- Unitary tests --*-- % OUTPUTS % - b [dates] First period where the N variables are observed (without NaNs). -% Copyright (C) 2016 Dynare Team +% Copyright (C) 2016-2017 Dynare Team % % This file is part of Dynare. % @@ -27,6 +27,9 @@ function d = firstobservedperiod(o) % --*-- Unitary tests --*-- b = ~isnan(o); c = find(prod(b, 2)); +if isempty(c) + error('No overlapping non-NaN data points found in dseries.'); +end d = firstdate(o)+(c(1)-1); %@test:1 -- GitLab