Removing highest and lowest 5% of data as outliers using prctile

I have some numerical data imported from an Excel sheet in a column. I want to remove the highest 5% and the lowest 5% of these numbers as outliers using the prctile function. How can I do this?
Thanks in advance!

 Respuesta aceptada

% Data values are in X; X2 holds remaining values after outliers removed
Y = prctile(X,[5,95]);
X2 = X(X>Y(1) & X<Y(2)); % maybe you want >= and <=, depending on your definition of outlier

1 comentario

I’ve surface damage depth (D) for 3D points (x, y, z). I’d like remove top and bottom 5% of the D values with their corresponding (x, y, z) from the matrix so that I can plot the remaining 90% of the points. Based on the attached sub set of the data, please kindly assist on the based way to achieve this.

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 2 de Nov. de 2020

Comentada:

el 11 de Jul. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by