From: The Dude on
Hi,

I'm interested in trying to re-write the following code using the arrayfun function:
%%%%%%%%%%%%%%%%%%%%%%%%
% Create dummy data
pressure = 1:5;
alt = repmat([0.5;1;1.5;3;4],[1 5 5 15]);
alt = permute(alt,[3 2 1 4]);
surf_alt = rand(5,5).*5;
surf_press = zeros(5,5,15);

% Interpolate surface height to find surface pressure
for i = 1:5
for j = 1:5
for k = 1:15
surf_press(i,j,k) = interp1(squeeze(alt(i,j,:,k)),pressure(:),... surf_alt(i,j),'linear','extrap');
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%

I've considered turning alt into a cell and using cellfun however I am dealing with large amounts of data and would like to avoid the memory overhead.

Any help is greatly appreciated.

Thanks