Path: news.mathworks.com!not-for-mail
From: "David " <sum_is_41@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Help averaging multidimensional array
Date: Mon, 20 Feb 2012 15:09:12 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <jhtnmo$ge3$1@newscl01ah.mathworks.com>
Reply-To: "David " <sum_is_41@hotmail.com>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1329750552 16835 172.30.248.38 (20 Feb 2012 15:09:12 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 20 Feb 2012 15:09:12 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3336373
Xref: news.mathworks.com comp.soft-sys.matlab:758228

Hello,

I have a multidimensional array:

gulf  60x90x456

60 and 90 refer to longitude and latitude, 456 is months. each long/lat point has a different value at each month: eg.

gulf(24,53,1) = -84.7

I need to average these values to 10 degree boxes; so the new dataset will become:

new 6x9x456

Obviously using the basic mean function doesnt work as this only produces means of each column therefor mean2 would be needed however the dataset includes many NaN values and mean2 does not account for this and as far as I am aware there is no nanmean equivalent for mean2.
I assume a for-loop would be the most sensible way of doing this but everything I have tried doesn't seem to work.

Any help would be hugely appreciated as this is very important!

Thanks