Mean/average of a variable

2 visualizaciones (últimos 30 días)
Auryn_
Auryn_ el 25 de En. de 2019
Editada: Adam el 25 de En. de 2019
Hello,
I have a variable P(a,b,c) where a=2, b=1:150,c=1:100.
Now, for each value of c, I want to calculate the mean of P:
M=mean(P(a,1:150,:))
where at the end I should have an array M(1,100).
Using what I showed above it does not work.
Coudl anyone help me?
Thanks in advance!

Respuesta aceptada

Matt J
Matt J el 25 de En. de 2019
Editada: Matt J el 25 de En. de 2019
M=mean(P(a,1:150,:),2)

Más respuestas (1)

Adam
Adam el 25 de En. de 2019
Editada: Adam el 25 de En. de 2019
M = mean( squeeze( P(a,:,:) )
should give what you want

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by