How to split the data wrt date in 3 dimensions array

9 ビュー (過去 30 日間)
Nam
Nam 2014 年 10 月 30 日
回答済み: Nam 2014 年 11 月 2 日
Hi all, I have data starts from 1/Jan/1979 to 31/Dec/2019 year with 3 dimensions array is 10x10x14975. I also have the 3 periods = [1979 1979 ; 1980 1999 ; 2000 2019]. So I want to split the data only with respect to period 2 and 3, then to simulate the mean for that each period. Please help me. Thanks you.

採用された回答

Andrei Bobrov
Andrei Bobrov 2014 年 10 月 30 日
ARR = randi(10,10,10,14975); % Your 3d array 10x10x14975
a = datenum([1979 1 1;2019 12 31]);
yy = [1979 1 1;1980 1 1;2000 1 1];
[yyyy,mm,dd] = datevec((a(1):a(2))');
n = numel(dd);
ii = cumsum(ismember([yyyy,mm,dd],yy,'rows'));
out = accumarray(ii,(1:n)',[],@(x){ARR(:,:,x)});

その他の回答 (1 件)

Nam
Nam 2014 年 11 月 2 日
Thanks Andrei Bobrov a lot. It is what I need.

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by