MATLAB Answers

how can I use mean for cell arrays within cell

1 view (last 30 days)
Farshid Daryabor
Farshid Daryabor on 25 Feb 2020
Commented: Farshid Daryabor on 26 Feb 2020
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,

Answers (1)

Bhaskar R
Bhaskar R on 25 Feb 2020
result = cellfun(@(x)mean(x, 'omitnan'), [T_mon{:}])
  2 Comments
Farshid Daryabor
Farshid Daryabor on 26 Feb 2020
The following comment is what I expected to be.
result = cellfun(@(x) nanmean(x,2), T_mon,'UniformOutput',false);
Thanks

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!