Matrix Manipulation Average of specific column
이전 댓글 표시
I have data in excel that is 17 columns by 4800 rows. I need to find all the numbers in each column separately that are greater then 10 and then find there average. This needs to be done for each 17 columns. Just unsure how to do this. Thank You!
답변 (1개)
the cyclist
2018년 9월 27일
편집: the cyclist
2018년 9월 27일
If A is the array with your values, then
A10 = (A > 10);
meanA = sum(A.*A10)./sum(A10)
댓글 수: 5
Brady Wayne Robinson
2018년 9월 27일
the cyclist
2018년 9월 27일
편집: the cyclist
2018년 9월 27일
Did you actually try the code? It finds the means of all columns at once. A10 is a logical variable that is true for each element of A that is greater than 10, and false if it is not. meanA is a 17-element vector of the means.
Brady Wayne Robinson
2018년 9월 27일
the cyclist
2018년 9월 27일
I don't quite follow your explanation.
I suggest you ...
- open up a new question
- give a very small illustrative example (e.g. maybe just 4x3) what the input matrix looks like
- explain what you expect for the output, and why
It's helpful if you define the input matrix in actual MATLAB code, and not just explain what it is like.
Brady Wayne Robinson
2018년 9월 27일
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!