while running this code i am getting this error (Error using pcolor (line 61) Matrix dimensions must agree), can anybody help me regarding this.
Afficher commentaires plus anciens
clc
clear
clear all
f='test1final.nc';
ncdisp(f);
lat1=ncread(f,'xlat');
lon1=ncread(f,'xlong');
temp=ncread(f,'t2');
for i = 1:size(temp,4)
mymap=pcolor(lon1,lat1,temp(:,:,:,i));
shading interp
end
2 commentaires
Jakob B. Nielsen
le 21 Jan 2020
The error tells you the "why"; your matrix dimensions are not the same. Check the dimenions; if for example lon1 is 1x10 and lat1 is 1x11 and temp is 10x10x5, there is your problem; lat1 has a different dimension than the others.
Another issue is that you seem to call a 4D matrix temp. Is it maybe only 3D, so your code should say (remove one :)
pcolor(lon1,lat1,temp(:,:,i));
Rajesh Sahu
le 21 Jan 2020
Réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!