deleting nan rows in a matrix

1 vue (au cours des 30 derniers jours)
joseph Frank
joseph Frank le 4 Mar 2012
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.

Réponse acceptée

the cyclist
the cyclist le 4 Mar 2012
AR1(any(isnan(AR1),2),:) = [];

Plus de réponses (1)

Image Analyst
Image Analyst le 4 Mar 2012
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),:)=[]

Catégories

En savoir plus sur NaNs dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by