Removing Highest and Lowest Measurements to Average

16 ビュー (過去 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 Center および File ExchangeJSON Format についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by