clearing specific data in matrix

2 visualizzazioni (ultimi 30 giorni)
Stijn
Stijn il 1 Mar 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

Risposta accettata

Oleg Komarov
Oleg Komarov il 1 Mar 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.

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by