Calculating a mean matrix of a cell array

3 次查看(过去 30 天)
Hi,
I have a A=78757x1 cell, consiting of {125×15 double} matrices.
How can I calculate the mean of all (78757) matrixes, ( "element-by-element" for each matrix) so that I have a mean Matrix of 125*15 at the end. A contains also sometimes NaN entries.
Thanks,
Chris

采纳的回答

Stephen23
Stephen23 2023-7-10
编辑:Stephen23 2023-7-10
M = mean(cat(3,A{:}),3,'omitnan')

更多回答(1 个)

Paul
Paul 2023-7-10
Try
mean(cat(3,A{:}),3,'omitnan')
The omitnan flag will ignor the nan entries in the computation of the mean.

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by