How do I vectorize this code below?

조회 수: 1 (최근 30일)
Emmanuel
Emmanuel 2016년 10월 22일
댓글: Walter Roberson 2016년 10월 23일
if(y+1 <= length(B))
if(sum(ismember(closed(:,1:2),[x,y+1],'rows'))== 0)
cost = hMap(x,y)+ B(x,y+1);
if(cost< hMap(x,y+1))
hMap(x,y+1) = cost;
open = [open;x,y+1,cost];
end
end
end
  댓글 수: 2
Matt J
Matt J 2016년 10월 22일
There are no loops in the code you've shown.
Walter Roberson
Walter Roberson 2016년 10월 23일
The open = [open;x,y+1,cost]; suggests it is in a loop, but we do not have information about which variable is being iterated over; we also do not have information about what the purpose of the code is.

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

답변 (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