MATLAB: How to plot contourf using following information

contourfMATLAB

I am having data as follows:
lon 256*1double
lat 128*1double
time 3654*1double
pr 256*128*3654double
I am using contourf(lon,lat,pr(:,:,:)) or contourf(lon,lat,pr(:,:,:)') but there is error of dimension

Best Answer

pr is a 3D matrix, you cannot use contourf on a 3D matrix. You need to draw layer by layer.
[m,n,p] = size(pr) ;
for i = 1:p
contourf(lon,lat,pr(:,:,i)) ; % if throws error, trispose pr
drawnow
end
Also have a look on slice.