Greta Stein
Greta Stein

Reputation: 75

How to filter out bad values in a data set regarding a matrix in matlab?

I wanted to ask any keen users here how to "filter out" bad values regarding a tremendous amount of a data matrix in matlab.

e.g: I have a MATLAB data file containing values 2*5000 (double) which represent x and y coordinates. How is it possible to delete all values above or under a certain limit?

or easier:

(matrix from data file)

1 2 4 134 2
3 5 5 4 2

or

1 2 4 9 2
3 5 5 234 2

setting a certain limit and delete column:

1 2 4 2
3 5 5 2

Upvotes: 1

Views: 117

Answers (1)

Thomas Sablik
Thomas Sablik

Reputation: 16450

  1. Find the "bad" elements, e.g. A < 0 | A > 20
  2. Find the "good" columns, e.g. ~max(A < 0 | A > 20)
  3. Keep the "good" columns / Remove the "bad" columns, e.g. A(:, ~max(A < 0 | A > 20))

Upvotes: 2

Related Questions