deleting nan rows in a matrix

조회 수: 2 (최근 30일)
joseph Frank
joseph Frank 2012년 3월 4일
Hi,
is there a simple method to delete the rows in which there is a nan in a matrix? I wrote the codes this way: [x1,y1]=find(isnan(AR1)); x1b=unique(x1); AR1(x1b,:)=[];
but I feel that I can delete these rows in a simpler way.

채택된 답변

the cyclist
the cyclist 2012년 3월 4일
AR1(any(isnan(AR1),2),:) = [];

추가 답변 (1개)

Image Analyst
Image Analyst 2012년 3월 4일
I think most people would use any. Here's a way but it's not necessarily much faster or better than your way:
AR1(any(isnan(AR1), 2),:)=[]

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by