필터 지우기
필터 지우기

finding NON in matrix

조회 수: 1 (최근 30일)
rahman
rahman 2011년 5월 24일
Hi all In the matrix A which is 1*N matrix, I want to recognize if there is any element equal to NON in it,I replace it by zero.How can I do that?
  댓글 수: 2
Sean de Wolski
Sean de Wolski 2011년 5월 24일
Do you mean NaN?
rahman
rahman 2011년 5월 24일
Oops!!
that a really big mistake!
yes, NON means NaN ;)

댓글을 달려면 로그인하십시오.

채택된 답변

Laura Proctor
Laura Proctor 2011년 5월 24일
I'm going to assume that you mean NaN. You can use the ISNAN function to find and replace the NaNs in your code. Here's an example:
A = randn(1,100);
A([2,10,23,47,88]) = NaN;
A(isnan(A)) = 0;
  댓글 수: 1
rahman
rahman 2011년 5월 24일
tnx lot

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 5월 24일
A(isnan(A)) = 0;
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 5월 24일
You're fast today, Sean!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by