Calculating a mean matrix of a cell array

2 Ansichten (letzte 30 Tage)
CSCh
CSCh am 10 Jul. 2023
Kommentiert: CSCh am 10 Jul. 2023
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

Akzeptierte Antwort

Stephen23
Stephen23 am 10 Jul. 2023
Bearbeitet: Stephen23 am 10 Jul. 2023
M = mean(cat(3,A{:}),3,'omitnan')

Weitere Antworten (1)

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

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by