I want to only run my loop till 22 but it shoud take odd numbers for x_random and even for y_random
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Bushra Atta Khakwani khakwani
el 4 de Oct. de 2022
Respondida: KSSV
el 4 de Oct. de 2022
while i < 22
if mod(i,2)==0
P(2,i) = y_random(i); %y coordinate
else
P(1,i) = x_random(i); %x coordinate
end
end
0 comentarios
Respuesta aceptada
KSSV
el 4 de Oct. de 2022
for i=1:22
if mod(i,2)==0
P(2,i) = y_random(i); %y coordinate
else
P(1,i) = x_random(i); %x coordinate
end
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements 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!