Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to remove a row containing NaN

Subject: how to remove a row containing NaN

From: vijay mulchandani

Date: 19 Nov, 2012 14:55:20

Message: 1 of 5

i have a velocity matrix of 98x124 and i want to remove the complete row where the velocity value is NaN, so that afterwards i can take the mean of the matrix. How can i delete it?

Subject: how to remove a row containing NaN

From: Wayne King

Date: 19 Nov, 2012 15:43:14

Message: 2 of 5

"vijay mulchandani" <vam11@tu-clausthal.de> wrote in message <k8dh8o$rka$1@newscl01ah.mathworks.com>...
> i have a velocity matrix of 98x124 and i want to remove the complete row where the velocity value is NaN, so that afterwards i can take the mean of the matrix. How can i delete it?

 X = randn(98,124);
 X(4,2) = NaN;
 [I,J] = find(isnan(X));
 X(I,:) = [];
 

Subject: how to remove a row containing NaN

From: dpb

Date: 19 Nov, 2012 16:38:11

Message: 3 of 5

On 11/19/2012 9:43 AM, Wayne King wrote:
> "vijay mulchandani" <vam11@tu-clausthal.de> wrote in message
> <k8dh8o$rka$1@newscl01ah.mathworks.com>...
>> i have a velocity matrix of 98x124 and i want to remove the complete
>> row where the velocity value is NaN, so that afterwards i can take the
>> mean of the matrix. How can i delete it?
>
> X = randn(98,124);
> X(4,2) = NaN;
> [I,J] = find(isnan(X));
> X(I,:) = [];

Alternatively,

X(any(isnan(X),2),:)=[];

--

Subject: how to remove a row containing NaN

From: vijay mulchandani

Date: 19 Nov, 2012 20:48:18

Message: 4 of 5

"Wayne King" wrote in message <k8dk2i$9ed$1@newscl01ah.mathworks.com>...
> "vijay mulchandani" <vam11@tu-clausthal.de> wrote in message <k8dh8o$rka$1@newscl01ah.mathworks.com>...
> > i have a velocity matrix of 98x124 and i want to remove the complete row where the velocity value is NaN, so that afterwards i can take the mean of the matrix. How can i delete it?
>
> X = randn(98,124);
> X(4,2) = NaN;
> [I,J] = find(isnan(X));
> X(I,:) = [];
>
thanks a lot

Subject: how to remove a row containing NaN

From: vijay mulchandani

Date: 19 Nov, 2012 20:49:24

Message: 5 of 5

dpb <none@non.net> wrote in message <k8dnb9$pge$1@speranza.aioe.org>...
> On 11/19/2012 9:43 AM, Wayne King wrote:
> > "vijay mulchandani" <vam11@tu-clausthal.de> wrote in message
> > <k8dh8o$rka$1@newscl01ah.mathworks.com>...
> >> i have a velocity matrix of 98x124 and i want to remove the complete
> >> row where the velocity value is NaN, so that afterwards i can take the
> >> mean of the matrix. How can i delete it?
> >
> > X = randn(98,124);
> > X(4,2) = NaN;
> > [I,J] = find(isnan(X));
> > X(I,:) = [];
>
> Alternatively,
>
> X(any(isnan(X),2),:)=[];
>
> --
>
thanks a lot

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us