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!

 Akzeptierte Antwort

Matt J
Matt J am 25 Jan. 2019
Bearbeitet: Matt J am 25 Jan. 2019

0 Stimmen

M=mean(P(a,1:150,:),2)

Weitere Antworten (1)

Adam
Adam am 25 Jan. 2019
Bearbeitet: Adam am 25 Jan. 2019

0 Stimmen

M = mean( squeeze( P(a,:,:) )
should give what you want

Kategorien

Gefragt:

am 25 Jan. 2019

Bearbeitet:

am 25 Jan. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by