How can i find the average for specific rows

조회 수: 1 (최근 30일)
nADER alqahtani
nADER alqahtani 2019년 1월 5일
답변: Andrei Bobrov 2019년 1월 5일
Region section1 section2 section3 section4
A 20 23 45 65
B 35 24 47 88
C 37 55 38 90
A 39 27 92 29
C 38 89 37 38
----------------------------------------------------------------------------
I have table looks like this table and i want to find the average for each cloumn put depending on the region .. for example i want to find the average of section1 for region A ( i have two regions in the table ) .

채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 1월 5일
T = readtable('file1.txt');
out = varfun(@mean,T,'g',1);

추가 답변 (1개)

dpb
dpb 2019년 1월 5일
Put into a table and use grpstats and friends...
  댓글 수: 2
nADER alqahtani
nADER alqahtani 2019년 1월 5일
what do you mean by friends
dpb
dpb 2019년 1월 5일
Just a generic phrase/indicator to also look at related functions and help topics. Primarily those other functions/topics that are linked to in the "See Also" section as starters...

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by