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:
Calculating variance disregarding NAN's

Subject: Calculating variance disregarding NAN's

From: Ulrik Nash

Date: 6 Nov, 2011 22:16:13

Message: 1 of 2

Hi,

I am not the proud owner of the statistics toolbox, so nanvar is not part of my arsenal. What command will allow me to cakculate the variance of each column of A, when these columns included NAN's and these should be ignored?

Regards,

Ulrik.

Subject: Calculating variance disregarding NAN's

From: Parag S. Chandakkar

Date: 6 Nov, 2011 22:21:23

Message: 2 of 2

On Nov 6, 3:16 pm, "Ulrik Nash" <u...@sam.sdu.dk> wrote:
> Hi,
>
> I am not the proud owner of the statistics toolbox, so nanvar is not part of my arsenal. What command will allow me to cakculate the variance of each column of A, when these columns included NAN's and these should be ignored?
>
> Regards,
>
> Ulrik.

%%%%%%%%%%%%%%%%%%%%
a=[1 2 3 NaN 5];
 a(isnan(a))=[];
 var(a)
%%%%%%%%%%%%%%%%%%%%

Regards,
- Parag S Chandakkar.

Tags for 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