extract numbers form a column
古いコメントを表示
I have a double collumn set of data, something like that:
Q= [0 15
0 18
0 12
1 12
2 15
0 17
0 12
2 7
0 12
0 11]
I need to get the mean values of ech array in column 2, where are zeros in column 1. Or at lest extract those aarays onto different variables, they need to be separated. Can anybody help me please?
Thank you
3 件のコメント
Sargondjani
2021 年 1 月 17 日
編集済み: Sargondjani
2021 年 1 月 17 日
Try something like:
ind0 = Q(:,1) ==0%select the entries where Q(:,1) is 0
Sum_Q0 = mean(Q(ind0,2))%take the mean of the entries of Q(:,2) where ind0==1
This might not be fasted way, but its simple :-)
ShonyE
2021 年 1 月 17 日
dpb
2021 年 1 月 17 日
See below...
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!