より効率的にするために、ループで次のことを行いたいです。
data_Clim1 = griddata(lonClim, latClim, ice_Clim(:,:,1), X, Y);
data_Clim2 = griddata(lonClim, latClim, ice_Clim(:,:,2), X, Y);
data_Clim3 = griddata(lonClim, latClim, ice_Clim(:,:,3), X, Y);
data_Clim4 = griddata(lonClim, latClim, ice_Clim(:,:,4), X, Y);
data_Clim5 = griddata(lonClim, latClim, ice_Clim(:,:,5), X, Y);
data_Clim6 = griddata(lonClim, latClim, ice_Clim(:,:,6), X, Y);
data_Clim7 = griddata(lonClim, latClim, ice_Clim(:,:,7), X, Y);
data_Clim8 = griddata(lonClim, latClim, ice_Clim(:,:,8), X, Y);
data_Clim9 = griddata(lonClim, latClim, ice_Clim(:,:,9), X, Y);
data_Clim10 = griddata(lonClim, latClim, ice_Clim(:,:,10), X, Y);
data_Clim11 = griddata(lonClim, latClim, ice_Clim(:,:,11), X, Y);
data_Clim12 = griddata(lonClim, latClim, ice_Clim(:,:,12), X, Y);
% Add together matrices
data_Clim = [data_Clim1; data_Clim2; data_Clim3; data_Clim4; ...
data_Clim5; data_Clim6; data_Clim7; data_Clim8; data_Clim9; ...
data_Clim10; data_Clim11; data_Clim12];
% Reshape to 3D matrix
data_Clim = reshape(data_Clim, 1437, 159, 12);
基本的に、360x161x12 のマトリックスがあり、それを 1437x159x12 に補間する必要があります。ただし、現在、griddata を使用すると、一度に 1 つの z 次元しか補間できません。次に、すべての個別のマトリックス (各月に 1 つなので 12 あります) を結合し、必要な次元に再形成します。
while ループまたは for ループの方が面倒ではないと思います。