How to remove multiple outlier data in a rectangular maze?

56 views (last 30 days)
I have this rodent x,y coordinates as described in the attached picture. There are some outliers in the data, I need to remove them. I have to dynamically define a zone based on the extreme coordinates in the quardrants.
For example, let's say I need to remove the outlier data circled in red. The datapoint is in Maze4. I have attached the data for Maze4. I want to remove the bins where histcounts2 is < 2. I also need the 'xcoordinates2' and 'ycoordinates2' array after cleaning the outliers. I tried this so far.
h4 = histogram2(Maze4.xcoordinates2, Maze4.ycoordinates2, ...
nbins,'DisplayStyle','tile','ShowEmptyBins','on');
counts4 = histcounts2(Maze4.xcoordinates2, Maze4.ycoordinates2, 25);
index4 = h4.Values(counts4<2);
But the index4 gives me 1-D array. How do I solve this?

Accepted Answer

Image Analyst
Image Analyst on 10 Jun 2022
First try to avoid the problem by not letting your rodents escape from your maze! 🐭🐹🐁🐀🤣
Then if you know your x coordinates must be between -80 and 80, use masking to extract only those good indexes:
% Find out which indexes are outside the -80 to 80 range.
mask = abs(x <= 80);
% Extract only those good indexes.
x = x(mask);
y = y(mask);
  5 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!