Calculating the median for each column based on unique values in 1st column

1 次查看(过去 30 天)
Hi all,
I've been search for a solution to this for a while now, and while i can find various ways that get me close, I cant seem to work out exactly what I want. I have a table of various sound metrics for some recordings. The table is 384744x5 with the 1st column being the start time of the recording (duplicated 24 times), and the other 4 are different values. Each file has 24 values taken from it and i want to produce a median value for each column, 2:5 for the 24 values. Ideally the output will be a 16031x5 table with column 1 being unique values of the start time, and columns 2-5 the median values.

采纳的回答

Thomas Webber
Thomas Webber 2020-7-9
I think I have managed to solve this problem.
Where UTC is the column of variables to group medians by, RMS, ZeroPEak, PeakPEak and SEL are columns to find median of.
omedian = @(x) median(x,'omitnan');
medianByRec = varfun(omedian,Filtered,'GroupingVariables','UTC',...
'InputVariables',{'RMS','ZeroPeak', 'PeakPeak', 'SEL'})

更多回答(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