Could anyone help me how to calculate the mean of cell array

1 visualización (últimos 30 días)
jaah navi
jaah navi el 5 de Ag. de 2021
Editada: Scott MacKenzie el 5 de Ag. de 2021
I am having
A=10x1 cell
in which each rows are as follows
[1,2]
[1,2]
[1,2]
[1,2]
[1,2]
[1,2]
[1,1]
[1,2]
[1,2]
[1,2]
Now I want to calculate the mean of A. Could anyone please help me on this.

Respuestas (1)

Scott MacKenzie
Scott MacKenzie el 5 de Ag. de 2021
Editada: Scott MacKenzie el 5 de Ag. de 2021
I'm guessing either m1 or m2 below is what you are looking for.
c = { [1 2]; [1 2]; [1 2]; [1 2]; [1 2]; [1 2]; [1 2]; [1 2]; [1 2]; [1 2]}
c = 10×1 cell array
{[1 2]} {[1 2]} {[1 2]} {[1 2]} {[1 2]} {[1 2]} {[1 2]} {[1 2]} {[1 2]} {[1 2]}
m1 = cellfun(@mean, c)
m1 = 10×1
1.5000 1.5000 1.5000 1.5000 1.5000 1.5000 1.5000 1.5000 1.5000 1.5000
m2 = mean(cellfun(@mean, c))
m2 = 1.5000

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by