Assignment error in double loops

1 vue (au cours des 30 derniers jours)
Oday Shahadh
Oday Shahadh le 6 Fév 2017
Commenté : KSSV le 6 Fév 2017
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));|

Réponse acceptée

KSSV
KSSV le 6 Fév 2017
Change
res=zeros(length(lat),long(lat));
to
res=zeros(length(lat),length(lat));
  5 commentaires
Oday Shahadh
Oday Shahadh le 6 Fév 2017
I just need to arrange:
long=linspace(0,360,288); lat=linspace(0,180,180);
in a 180X288 matrix to
KSSV
KSSV le 6 Fév 2017
[X,Y] = meshgrid(long,lat)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by