I have an array that can be of any size (in rows), but always has a width of two columns. I would like to throw away any rows containing numbers that deviate more than the median of each column.
For instance:
array = 2 5 3 4 9 5 2 8 3 5 . . . . . . etc
In the above example, the median (array) gives [2 5]. Thus, for the columns above, I would expect the third and fourth rows to be eliminated, since row three contains 9 in the first column, and the fourth row contains 8 in the second column, both of which are outside my limit (1 away from the median ) Note that I want to drop BOTH columns if the EITHER column contains a number that is not within 1 of the median for this column.
Any help would be greatly appreciated ...
source share