Removing Highest and Lowest Measurements to Average

조회 수: 15 (최근 30일)
Sophie Leiter
Sophie Leiter 2021년 4월 16일
댓글: Sophie Leiter 2021년 4월 19일
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
Image Analyst
Image Analyst 2021년 4월 17일
편집: Image Analyst 2021년 4월 17일
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 2021년 4월 19일
Yes, thank you! I ended up doing a combination of both your answers and it worked well. Thanks for helping me!

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2021년 4월 16일
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)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 JSON Format에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by