Hi
I'm having trouble plotting my netcdf file. I use pcolor, but the first time I tried I had noted Z'. This broke it over and said I should use permute I have done that now, now it comes with the error Matrix dimensions must agree. Why?
if true filename='Januar79.nc'%Read the header
ncdisp(filename)%surf_temp
%Open the file in read only mode
ncid=netcdf.open(filename,'NOWRITE')%inspect num of dimensions, variables, attributes, unim
[ndim, nvar, natt, unlim]=netcdf.inq(ncid)for i=0:nvar-1[varname, xtype, dimid, natt]=netcdf.inqVar(ncid,i);if strcmp(varname,'surf_temp')==1 varnumber=i;endendfor i=1:length(dimid) [dimname, dimlength]=netcdf.inqDim(ncid,dimid(1,i))endfor i=0:nvar-1[varname, xtype, dimid, natt]=netcdf.inqVar(ncid,i);if strcmp(varname,'latitude')==1 dimnumber=iendendlatitude=ncread(filename,'latitude')longitude=ncread(filename,'longitude')Z=ncread(filename,'z')pcolor(latitude,longitude,permute(Z, [2 1 3]))load coasthold onplot(long,lat,'k','LineWidth',1.5)plot(long+360,lat,'k','LineWidth',1.5) end
Best Answer