I tried this
long=linspace(0,360,288);
lat=linspace(0,180,180);
res=zeros(length(lat),long(lat));
for i=1:length(long)
for j=1:180
res=[long(i) lat(j)];
end
end
and got this error
Subscript indices must either be real positive integers or logicals.
| Error in odayalbedo (line 9) res=zeros(length(lat),long(lat));|

 採用された回答

KSSV
KSSV 2017 年 2 月 6 日

0 投票

Change
res=zeros(length(lat),long(lat));
to
res=zeros(length(lat),length(lat));

5 件のコメント

Oday Shahadh
Oday Shahadh 2017 年 2 月 6 日
Thanks but it does not save the loop in preallocation matrix, Do I have to use: res(i,j)=[long(i) lat(j)]; instead?
Oday Shahadh
Oday Shahadh 2017 年 2 月 6 日
I must get 180X288 matrix pls help
KSSV
KSSV 2017 年 2 月 6 日
What is the relation between long and lat to get required matrix?
Oday Shahadh
Oday Shahadh 2017 年 2 月 6 日
I just need to arrange:
long=linspace(0,360,288); lat=linspace(0,180,180);
in a 180X288 matrix to
KSSV
KSSV 2017 年 2 月 6 日
[X,Y] = meshgrid(long,lat)

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2017 年 2 月 6 日

コメント済み:

2017 年 2 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by