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:
Missing values in a matrix

Subject: Missing values in a matrix

From: kate

Date: 20 Apr, 2011 21:53:04

Message: 1 of 3

Hi everyone,

I’m using Matlab programming in reading a 14 (number of time points that measurements were taken per patient) by 10 (number of patients) matrix but some of the values are missing (there is volume and lesion measurements in the brain of patients measured at time (in month) -3, -2,-1,0,1,2,3,4,5,6,12,24,30,36 with minus sign indicating measurement before the baseline (zero). I was wondering whether there is a way to ignore the NAN in Matlab, when the missing data are filled in, i should do more sophisticated analysis on them (not like just taking mean or sum...). Also, is there any imputation method available in Matlab?
Any help would be appreciated.

Subject: Missing values in a matrix

From: Paulo Silva

Date: 20 Apr, 2011 22:10:05

Message: 2 of 3

"kate" wrote in message <ionkk0$m9o$1@fred.mathworks.com>...
> Hi everyone,
>
> I’m using Matlab programming in reading a 14 (number of time points that measurements were taken per patient) by 10 (number of patients) matrix but some of the values are missing (there is volume and lesion measurements in the brain of patients measured at time (in month) -3, -2,-1,0,1,2,3,4,5,6,12,24,30,36 with minus sign indicating measurement before the baseline (zero). I was wondering whether there is a way to ignore the NAN in Matlab, when the missing data are filled in, i should do more sophisticated analysis on them (not like just taking mean or sum...). Also, is there any imputation method available in Matlab?
> Any help would be appreciated.

Ignore NaN?!

a=[1 nan 2 3];
a(~isnan(a))

Replace all NaN by some value?!

a(isnan(a))=0

Subject: Missing values in a matrix

From: kate

Date: 21 Apr, 2011 15:54:06

Message: 3 of 3

"Paulo Silva" wrote in message <ionljt$92m$1@fred.mathworks.com>...
> "kate" wrote in message <ionkk0$m9o$1@fred.mathworks.com>...
> > Hi everyone,
> >
> > I’m using Matlab programming in reading a 14 (number of time points that measurements were taken per patient) by 10 (number of patients) matrix but some of the values are missing (there is volume and lesion measurements in the brain of patients measured at time (in month) -3, -2,-1,0,1,2,3,4,5,6,12,24,30,36 with minus sign indicating measurement before the baseline (zero). I was wondering whether there is a way to ignore the NAN in Matlab, when the missing data are filled in, i should do more sophisticated analysis on them (not like just taking mean or sum...). Also, is there any imputation method available in Matlab?
> > Any help would be appreciated.
>
> Ignore NaN?!
>
> a=[1 nan 2 3];
> a(~isnan(a))
>
> Replace all NaN by some value?!
>
> a(isnan(a))=0


Thanks Paulo,
I should have explained it more; i put nan's instead of the missing values in order to read the data in a 14 x 10 matrix (rows correspond to measurement of lesion numbers in the brain and columns corresponds to patients). Otherwise it cannot be read as matrix with different length. Now in my analysis i need to estimate a curve using the values available for each patient, here I’m in trouble since the input for making these discrete points to a function (smooth_ basis) need a matrix as input. Those nan's cause problem and i don't get any result. I’m not sure if i need to impute the missing one? Any thought? Thanks a lot.

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