Assignment error in double loops

1 次查看(过去 30 天)
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
Change
res=zeros(length(lat),long(lat));
to
res=zeros(length(lat),length(lat));
  5 个评论
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by