how to stack monthly(hist)
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi
I have time series. I want to stack monthly(hist). I need to count how many times my time series repeated in every month for given long period and stack each month results. January+January, February+February, March+March..... Such as January would be repeated 250, February 300, March 280.......
(Please see attached excel file).
Thanks a lot!
댓글 수: 0
채택된 답변
Andrei Bobrov
2017년 3월 24일
[~,~,c] = xlsread('stack_monthly.xlsx');
[y,m] = datevec(c,'yyyy-mm-ddTHH:MM:SS.FFFZ');
a = unique([y,m],'rows');
out = accumarray(a(:,2),1);
댓글 수: 4
Andrei Bobrov
2017년 3월 29일
[d,~,c] = xlsread('stack_montlyvalues.xlsx');
[~,m] = datevec(c(:,1),'yyyy-mm-ddTHH:MM:SS.FFFZ');
[a,~,ii] = unique(m);
out = [a,accumarray(ii,d)];
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!