Removing Highest and Lowest Measurements to Average

15 Ansichten (letzte 30 Tage)
Sophie Leiter
Sophie Leiter am 16 Apr. 2021
Kommentiert: Sophie Leiter am 19 Apr. 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 Kommentare
Image Analyst
Image Analyst am 17 Apr. 2021
Bearbeitet: Image Analyst am 17 Apr. 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 am 19 Apr. 2021
Yes, thank you! I ended up doing a combination of both your answers and it worked well. Thanks for helping me!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 16 Apr. 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)

Weitere Antworten (0)

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by