Average a section of a column in a table based on another column values
    조회 수: 13 (최근 30일)
  
       이전 댓글 표시
    
Hi,
I'm trying to average the values of a column(T3.value) coresponding to a different column in the same table (T3.index). T3.index goes form 0 to 10 in this example and output in another table with a single value for index and a single value for 'value'.
index average_value
0               x 
1               y
.                . 
.                . 
10             z
i=T3.index
for i=1:max(i)
  A(i)=mean(T3.value(i))
end
댓글 수: 0
채택된 답변
추가 답변 (1개)
  Lola Davidson
    
 2022년 5월 19일
        Hi Gabi,
We actually have several functions that can help with these "grouped calculations". In particular, I think groupsummary would be the easiest thing to use here:
T_means = groupsummary(T3,'index','mean');
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


