From 4ff18a3a70aeb83699b5c8b91020c23ddc1d9a15 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stepan@adjemian.eu>
Date: Wed, 7 Oct 2020 16:45:32 +0200
Subject: [PATCH] Fixed subsample selection with daily frequency.

---
 src/@dseries/subsref.m | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/@dseries/subsref.m b/src/@dseries/subsref.m
index e6f129a..415d65a 100644
--- a/src/@dseries/subsref.m
+++ b/src/@dseries/subsref.m
@@ -132,7 +132,8 @@ switch S(1).type
             'lineartrend', ...
             'resetops', 'resettags', ...
             'subsample', ...
-            'projection'}
+            'projection', ...
+            'timeaggregation'}
         if length(S)>1 && isequal(S(2).type,'()')
             if isempty(S(2).subs)
                 r = feval(S(1).subs,o);
@@ -219,7 +220,11 @@ switch S(1).type
             error(['dseries::subsref: Indices are out of bounds! Subsample cannot end after ' date2string(o.dates(end)) '.'])
         end
         % Extract a subsample using a dates object
-        [~,tdx] = intersect(o.dates.time,Dates.time,'rows');
+        if o.dates.freq==365
+            [~,tdx] = intersect(o.dates.time(:,1),Dates.time(:,1));
+        else
+            [~,tdx] = intersect(o.dates.time,Dates.time,'rows');
+        end
         r = copy(o);
         r.data = r.data(tdx,:);
         r.dates = r.dates(tdx);
-- 
GitLab