The size of X must match the size of Z or the number of columns of Z.
Ältere Kommentare anzeigen
Hi there
I have a netcdf file I have running in MatLab. But I want to plot contour lines for the geostrophic wind. When I running my code i got the fail "The size of X must match the size of Z or the number of columns of Z." Someone there could help me?
if true
figure(2);
clow=4680; chigh=6000; cint=60;
conts = [clow:cint:chigh];
V = [clow:cint*2:chigh];
[c,h]=contour(lat,lon,z,conts,'linewidth',1.5,'color','k');
clabel(c,h,V);
quiver(latv,lonv,vg500,ug500)
title('Geopotential height and geostrophic wind at 500 hPa')
xlabel('longitude'), ylabel('latitude')
figure(3)
clow=4680; chigh=6000; cint=60;
conts = [clow:cint:chigh];
V = [clow:cint*2:chigh];
[c,h]=contour(lat,lon,z,conts,'linewidth',1,'color','k');
clabel(c,h,V);
pcolor(latv,lonv,Vg);
shading interp
colorbar('v');
title('geopotential height and magnitude of geostrophic wind at 500 hPa')
xlabel('longitude'), ylabel('latitude')
end
3 Kommentare
Walter Roberson
am 10 Okt. 2018
Which line is producing the error? What are the sizes of each of the variables mentioned on that line?
It is common to confuse x and y on a matrix. X corresponds to columns not rows.
Jonas Damsbo
am 10 Okt. 2018
Bearbeitet: Walter Roberson
am 10 Okt. 2018
Walter Roberson
am 10 Okt. 2018
Your lat variable is about 54 times too large. It would have to be 181 long for that z data.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Oceanography and Hydrology finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!