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!