필터 지우기
필터 지우기

Extract from lines from matrix that do not contain NaN

조회 수: 2 (최근 30일)
Lily
Lily 2012년 10월 11일
Hi
I'm trying to ignore NAN from my matrix A and only use the lines that contain numbers. For expamle if my matrix is:
A = [0.02, 1.28, 0.22; 0.01, 0.64, 0.12; 0, NaN, NaN; 0, NaN, 0.05; 0, NaN, NaN];
Here I would only like to extract the following data from the matrix A:
A_extract = [0.02, 1.28, 0.22; 0.01, 0.64, 0.12];
Is it possible to do a general solution for this problem?

채택된 답변

Matt J
Matt J 2012년 10월 11일
A_extract=A(~any(isnan(A),2),:)
  댓글 수: 1
Lily
Lily 2012년 10월 11일
편집: Lily 2012년 10월 11일
Thx so much for this :)

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

추가 답변 (0개)

카테고리

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