clearing specific data in matrix

2 visualizaciones (últimos 30 días)
Stijn
Stijn el 1 de Mzo. de 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

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 1 de Mzo. de 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.

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by