Mean/average of a variable

4 次查看(过去 30 天)
Auryn_
Auryn_ 2019-1-25
编辑: Adam 2019-1-25
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!

采纳的回答

Matt J
Matt J 2019-1-25
编辑:Matt J 2019-1-25
M=mean(P(a,1:150,:),2)

更多回答(1 个)

Adam
Adam 2019-1-25
编辑:Adam 2019-1-25
M = mean( squeeze( P(a,:,:) )
should give what you want

类别

Help CenterFile Exchange 中查找有关 Semiconductors and Converters 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by