skip a number after every two number in for loop
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
yogi patel
el 21 de En. de 2019
Comentada: yogi patel
el 21 de En. de 2019
Hello,
I want to execute a for loop from value 1 to 10.
but within this range I want to skip number 3, 6 and 9. could you please help with the logic of skipping specific number at regular.
0 comentarios
Respuesta aceptada
madhan ravi
el 21 de En. de 2019
Editada: madhan ravi
el 21 de En. de 2019
L=1:10;
for k = L(~ismember(L,3:3:L(end)))
k
end
4 comentarios
madhan ravi
el 21 de En. de 2019
Thank you John D‘Errico I was about to post this as another possible solution.
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!