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

2 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Thomas Webber
Thomas Webber el 9 de Jul. de 2020
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'})

Más respuestas (0)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by