Average of 2 columns within a 3 column matrix

3 ビュー (過去 30 日間)
Brendan Clark
Brendan Clark 2021 年 5 月 17 日
回答済み: David Hill 2021 年 5 月 17 日
I have a matrix X with dimensions [288 192 60] or [lat lon time]. I want to find the average value of the first two columns to get a matrix that is just [space time] or [1 60] (aka a single average value of space for each unit time).
I tried:
X = mean(X,[1 2],'omitnan');
X = X(:,:);
But this seems to not be giving me correct values. Does anyone know the correct way to do this?

回答 (1 件)

David Hill
David Hill 2021 年 5 月 17 日
for k=1:60
x(k)=mean(X(:,:,k),'all','omitnan');
end

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by