What does this code do

1 visualización (últimos 30 días)
phillip kataswa
phillip kataswa el 6 de Abr. de 2020
Respondida: Image Analyst el 6 de Abr. de 2020
doorsorted = [];
for h = 1:length(door)
if numberOfDoors(h) == "2"
doorsorted = [doorsorted2];
elseif numberOfDoors(h) == "3"
doorsorted = [doorsorted3];
elseif numberOfDoors(h) == "4"
doorsorted = [doorsorted4];
elseif numberOfDoors(h) == "5more"
doorsorted = [doorsorted5];
end
end

Respuestas (1)

Image Analyst
Image Analyst el 6 de Abr. de 2020
It sets the variable doorsorted to one of 4 other variables depending on the value of the h'th element of numberOfDoors. It repeats this for a number of times that's equal to the number of elements in door, overwriting doorsorted each time so that it just ends up with whatever array got assigned to it on the very last iteration.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by