deleting nan rows in a matrix

1 次查看(过去 30 天)
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