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

2 views (last 30 days)
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!

Accepted Answer

Image Analyst
Image Analyst on 21 Oct 2020
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)

More Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!