フィルターのクリア

Separate values for year and month

1 回表示 (過去 30 日間)
Danilo M
Danilo M 2016 年 8 月 18 日
回答済み: Azzi Abdelmalek 2016 年 8 月 18 日
I have a time series matrix from year 1997 until now, and I want to create a diferent matrix for each year and, after that, separate the months of each year. How can I do that on Matlab?
Matrix example:
Yr Mo Day Hr Min
1997 01 01 00 00
1997 01 01 01 00
...
2016 01 01 00 00

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 8 月 18 日
Look at this example:
d1=datenum('1997-01-01 00:00','yyyy-mm-dd HH:MM');
d2=datenum('2016-08-31 00:00','yyyy-mm-dd HH:MM');
M=d1:1/24:d2;
d=datevec(M);
[ii,jj,kk]=unique(d(:,1:2),'rows');
out=accumarray(kk,(1:numel(kk))',[],@(x) {d(x,:)})

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by