cell array index mean

2 ビュー (過去 30 日間)
Matlab_G
Matlab_G 2022 年 11 月 21 日
回答済み: David Hill 2022 年 11 月 21 日
Hello,
I have a 42x1 cell array representing data of 42 years where each cell is a 1x12 array representing the mean of each month
I would like to create a 12x1 cell array that takes the average of each each month for the full 42 years.
I preallocated a 12x1 cell, A and this is the loop that i am trying to create:
a=cell(12,1)
for k=1:12
a
a{k}=mean(monthly_average_cell(1:42,(k)))
end
thanks

回答 (1 件)

David Hill
David Hill 2022 年 11 月 21 日
a=mean(cell2mat(monthly_average_cell));%why use a cell array? this matrix provides the answer

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by