how can I use mean for cell arrays within cell

2 次查看(过去 30 天)
Dear users,
I want to calculate the annual average of the attached file from the data in the cell array, regardless of the NaNs values.
Thanks in advance,

回答(1 个)

Bhaskar R
Bhaskar R 2020-2-25
result = cellfun(@(x)mean(x, 'omitnan'), [T_mon{:}])
  2 个评论
Farshid Daryabor
Farshid Daryabor 2020-2-25
Bhaskar, thanks for your comment, but I want to keep the order of the temperature values ​​with respect to the depth decrease as in the original. Could you please leave me your idea. Thanks
Farshid Daryabor
Farshid Daryabor 2020-2-26
The following comment is what I expected to be.
result = cellfun(@(x) nanmean(x,2), T_mon,'UniformOutput',false);
Thanks

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Verification, Validation, and Test 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by