Trying to take the median values of all of the columns within a 16000x171 table

조회 수: 2 (최근 30일)
Hello!
I am trying to take the median values of all of the columns within a 16000x171 table but received errors despite trying varfun, splittapply, median itself, etc. How would I go about taking the median or applying functions to all of the columns in the table?
Thank you for the help!
  댓글 수: 2
Torsten K
Torsten K 2020년 10월 21일
Maybe you are searching for this?
A = (1:10)'
B = (11:20)'
T = table(A,B)
func = @median
M = varfun(func,T)

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

채택된 답변

Image Analyst
Image Analyst 2020년 10월 21일
Try this:
% Create sample data.
col1 = rand(160, 1);
col2 = rand(160, 1);
t = table(col1, col2)
% Convert table to matrix.
m = table2array(t);
% Get median over rows in each column
columnMedians = median(m, 1)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by