while running this code i am getting this error (Error using pcolor (line 61) Matrix dimensions must agree), can anybody help me regarding this.

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 件のコメント

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
Rajesh Sahu 2020 年 1 月 21 日
Ok sir thanks

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

タグ

質問済み:

2020 年 1 月 21 日

コメント済み:

2020 年 1 月 21 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by