Filter löschen
Filter löschen

how to stack monthly(hist)

1 Ansicht (letzte 30 Tage)
davit petraasya
davit petraasya am 24 Mär. 2017
Kommentiert: davit petraasya am 3 Apr. 2017
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!

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 24 Mär. 2017
[~,~,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 Kommentare
Andrei Bobrov
Andrei Bobrov am 29 Mär. 2017
[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)];
davit petraasya
davit petraasya am 3 Apr. 2017
Thanks a lot for your help again Andrei. Code is working!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by