[英]How to calculate correlation coefficient and P-value between three dimensional matrix
[英]How to calculate yearly values from monthly data in three dimensional matrix?
我有3維矩陣的月降雨量數據,我想根據月降雨量數據計算年總降雨量。 三維數據(180 x 360 x 120),其中180 x 360是1度乘1度網格,而120是月數(十年)。
現在,我想通過將每年的月度值相加(12 * 10 = 120)來將月度值隱含為年,這樣在求和后我的最終輸出將為180 x 360 x 10。
嘗試這個:
% create sample data
tt = rand(180,360,120);
% aggregate monthly data to yearly
ttt = reshape(tt,180,360,12,[]); % reshape to separate individual months
ttt = sum(ttt,3); % sum over years
ttt = squeeze(ttt); % squueze 4D array into 3D array
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.