Mean/average of a variable

7 ビュー (過去 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 Center および File ExchangeSemiconductors and Converters についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by