"Evan" wrote in message <ef2d052.-1@webx.raydaftYaTP>...
> I simply just want to calculate the mean of a m by n matrix (usually
> you would just use mean2). However the matrices conatin NaNs, there
> is a nanmean for 1D vectors but no nanmean2. How can i get around
> this?
>
> Thank you very much in advance for any help
>
> Evan.
There's a surprisingly easy way! Since nanmean takes the mean of each column and then puts those means into an array, do nanmean multiple times until you have the desired number of values.
For example,
avg = nanmean(nanmean(nanmean(my_array)));
> I simply just want to calculate the mean of a m by n matrix (usually
> you would just use mean2). However the matrices conatin NaNs, there
> is a nanmean for 1D vectors but no nanmean2. How can i get around
> this?
>
> Thank you very much in advance for any help
>
> Evan.
There's a surprisingly easy way! Since nanmean takes the mean of each column and then puts those means into an array, do nanmean multiple times until you have the desired number of values.
For example,
avg = nanmean(nanmean(nanmean(my_array)));