How do I vectorize this code below?

1 Ansicht (letzte 30 Tage)
Emmanuel
Emmanuel am 22 Okt. 2016
Kommentiert: Walter Roberson am 23 Okt. 2016
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 Kommentare
Matt J
Matt J am 22 Okt. 2016
There are no loops in the code you've shown.
Walter Roberson
Walter Roberson am 23 Okt. 2016
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by