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
[X,Y] = meshgrid(long,lat)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating 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