MATLAB: How to solve “Transpose on ND array is not defined. Use PERMUTE instead.”

interpolationtranspose

wave_1
ans =
72 16 12
Error using .'
Transpose on ND array is not defined. Use PERMUTE instead.
Error in interp2 (line 131)
V = V.';
Error in wave_1 (line 43)
slp_po_in = interp2(lonx,laty,slp, x_po_in, y_po_in,'linear');
% main code
clear;close all;
% use ncdisp(filename) to discover file contents...
lat=ncread('ds010.0.20130511.20130516.nc','lat');
lon=ncread('ds010.0.20130511.20130516.nc','lon');
slp=ncread('ds010.0.20130511.20130516.nc','slp');
size(slp)
[row, col] = size(slp);
slp_cen = 99999999999.9;
for icen = 1:length(slp)
for jcen = 1:length(slp)
if slp(icen,jcen)<slp_cen
slp_cen = slp(icen,jcen);
i_cen = icen;
j_cen = jcen;
end
end
end
[lonx,laty] = meshgrid(1:1:300,300:-1:1);
i_ceny = laty(i_cen,1);
j_cenx = j_cen;
lonx = lonx - j_cenx;
laty = laty - i_ceny;
%---wavenumber 1---sigma=0.9----r<100km-
rmax = 25;
rmin = 0.5;
thetad=2; %interpolate angle grid
disd =0.5 ; %interpolate grid
for idis = 1:1:((rmax-rmin)/disd+1)
for ith = 1:1:(360/thetad)
x_po_in(ith,idis) = ((idis-1)*disd+rmin)*cos((ith-1)*thetad*pi/180);
y_po_in(ith,idis) = ((idis-1)*disd+rmin)*sin((ith-1)*thetad*pi/180);
end
end
slp_po_in = interp2(lonx,laty,slp, x_po_in, y_po_in,'linear');
for i = 1:size(x_po_in,2)
slp_w1_in(:,i) = fft(slp_po_in(:,i),1,1);
slp_w1_in(:,i) = slp_w1_in(:,i) - sum(slp_w1_in(:,i))/180;
end
hold on
figure
[C1,h1] = contour(x_po_in,y_po_in, slp_po_in);
hold off;

Best Answer

The variable slp has three dimensions. Either:
  • Change slp so that it is a matrix.
  • Change your code to use interp3 or interpn.