필터 지우기
필터 지우기

How to select non-NaN from a matrix?

조회 수: 31 (최근 30일)
balandong
balandong 2017년 11월 20일
답변: balandong 2017년 11월 20일
Say we are only interested to extract row with only a non-NAN,
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 NaN 0 NaN
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
NaN 1 1 1 0 0
That is, row 1,2,4,5,6,7,8,9.

채택된 답변

balandong
balandong 2017년 11월 20일
The following should work
X = ones(10,4);
X(3,4) = NaN;
X(3,6) = NaN;
X(10,1) = NaN;
newData=X((all((~isnan(X)),2)),:);

추가 답변 (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