clearing specific data in matrix

조회 수: 2 (최근 30일)
Stijn
Stijn 2012년 3월 1일
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

채택된 답변

Oleg Komarov
Oleg Komarov 2012년 3월 1일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by