필터 지우기
필터 지우기

Save coordinates in an array

조회 수: 15 (최근 30일)
Oliver Lestrange
Oliver Lestrange 2020년 8월 28일
답변: Walter Roberson 2020년 8월 28일
Hi,
I am itereting two loops, in order to form coordinates.
I am trying to save them with this line, because I want to keep it in an array.
[idx_x, idx_y] = [[idx_x, idx_y] ;[xi, yi] ];
xi and yi are the indexes of the loop.
for yi=1:mapa.ylength
for xi=1:mapa.xlength
if mapa.img(xi,yi,1) == 0
at(xi,yi) = at(xi,yi) + 20;%+ 26;
alturas(xi,yi) = mapa.buildingHeight;
else
alturas(xi,yi) = Movel.Altura;
end
[idx_x, idx_y] = [[idx_x, idx_y] ;[xi, yi] ];
heights = [heights; alturas(xi,yi)];
end
end
How can I do this?
Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2020년 8월 28일
idx_x(end+1) = xi;
idx_y(end+1) = yi;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by