MATLAB: Divide data and take the median

datadivide

Hi I want to ask about divide data and take its median for example, a=[1:100] b=sqrt(a.*2);
I want to take the median of every 20 data. How should it be?

Best Answer

If you want to take the median of ‘b(1:20)’, ‘b(21:40)’..., this works:
med_b = median(reshape(b(:), 20, []));
Related Question