clearing specific data in matrix

2 Ansichten (letzte 30 Tage)
Stijn
Stijn am 1 Mär. 2012
Hi,
I have a question about clearing specific data in a matrix.
I have a matrix [1,14880] The data is between 1 and -20 I only need data that is above -5! Because below -5 are data errors.
How can i do this?
thanks in advance
Stijn

Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 1 Mär. 2012
Use logical indexing :
idx = A <= -5;
A(idx) = NaN;
where A is your matrix and NaN stands for Not a Number.
I advice you to read the getting started guide. In your case the second chapter is fundamental. More specifically the logical indexing part is http://www.mathworks.co.uk/help/techdoc/learn_matlab/f2-14896.html#f2-15124.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by