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

조회 수: 2 (최근 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에서 Simulation, Tuning, and Visualization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by