Removing Highest and Lowest Measurements to Average

16 visualizaciones (últimos 30 días)
Sophie Leiter
Sophie Leiter el 16 de Abr. de 2021
Comentada: Sophie Leiter el 19 de Abr. de 2021
I have a large set of volume measurments I need to sort through. I have about 150 samples and for each sample the instrument measures the volume 10 times and reports all 10. Our procedure is to remove the highest and lowest values and then average the remaining eight. As it stands I've been doing it manually, but with such a large dataset I would prefer to automate it. I'm not even really sure where to start for the matlab code. Selecting out the mins and maxes to make a new list works individually but I don't know how to scale that to 150 samples.
Thanks!
  4 comentarios
Image Analyst
Image Analyst el 17 de Abr. de 2021
Editada: Image Analyst el 17 de Abr. de 2021
Sophie, did you even see my Answer below? I also showed you how to process a sequence of files like you asked. It also shows you how to remove the min(s) and max(es) from the list. The Comment above will not remove them all if there is more than one min or max.
Sophie Leiter
Sophie Leiter el 19 de Abr. de 2021
Yes, thank you! I ended up doing a combination of both your answers and it worked well. Thanks for helping me!

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 16 de Abr. de 2021
To process a sequence of files, see code samples in the FAQ:
Once you've read in the data, you can get the min and max and remove them from the sum:
minValue = min(data(:));
maxValue = max(data(:));
% Min and max may occur more than once. Find out how many times they occur.
numMins = sum(data(:) == minValue)
numMaxs = sum(data(:) == maxValue)
theSum = sum(data(:) - numMins * minValue - numMaxs * maxValue)
theMean = theSum / (numel(data) - numMins - numMaxs)

Más respuestas (0)

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by