Rich,
You're welcome. Accumarray is one of those really useful MATLAB functions that nobody knows about. I only found out about it recently!
Good luck with the rest of your work...
Tom
"Rich " <richard.dyer@eumetsat.int> wrote in message <hgdjk6$kdi$1@fred.mathworks.com>...
> Cheers Tom,
>
> that really did the trick. 'Accumarray' was the crux function that I was missing.
>
> I had to pad my data set out with a dummy border and then crop it to make sure I had at least one of each latitude and longitude, but apart from that I pretty much just pasted your code in and it worked  *very* quick too!
>
> Rich
>
> %height of 0 confirms no geolocation data for this sample
> i = find(myData.HGHT ~= 0);
>
> %turn lat and long into indeces by flooring and adding 91, 181
> %add data to give matrix a dummy border that can be removed
> %this ensures we have at least 1 of each lat and long.
> x = [floor(myData.LONG(i)+181); (1:1:360)'; (zeros(180,1)+361)];
> y = [floor(myData.LATI(i)+91); (zeros(360,1)+181); (1:1:180)'];
> z = [myData.ALL_PARA(i); zeros(540,1)];
> A = accumarray([x y],z);
>
> edges{1} = 1:1:361;
> edges{2} = 1:1:181;
> N = hist3([x y],'Edges',edges);
>
> %Calc mean z value and crop off dummy border
> meanZ = A./N;
> meanZ = meanZ(1:360, 1:180);
>
> imagesc([180 180],[90 90],meanZ', 'parent', ax1)
