Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Thomas Webber
Thomas Webber le 9 Juil 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'})

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by