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 drawnowendAlso have a look on slice. Related SolutionsMATLAB: Generating Geographical matrix using Loop Are you looking for this?M = 288 ; N = 180 ;long=linspace(0,360,M);lat=linspace(0,180,N);[Long,Lat] = meshgrid(long,lat) ;You cannot save [long(i) lat(j)] into res(i,j). res(i,j) needs a single number and [long(i) lat(j)] are two numbers. Else there should be some other relation between long and lat. MATLAB: How can plot precipitation data with latitude longitude information? I have matrix of precipitation over the time,latitude and longitude all are in 470*160*140 dimensions. Let lon, lat, P be your matrices of size 470*160*140. [m,n,p] = size(P) ;for i = 1:p pcolor(lon(:,:,i),lat(:,:,i),P(:,:,i)) ; shading interp colorbar drawnow endYou can also use surf, contour, countourf. Related QuestionAssignment error in double loopsHow to add three dimensional data points to MATLABHow to replace data in an array in a specific order
Best Answer