while running this code i am getting this error (Error using pcolor (line 61) Matrix dimensions must agree), can anybody help me regarding this.
Show older comments
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 Comments
Jakob B. Nielsen
on 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
on 21 Jan 2020
Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!