How to transform a wile loop into a for loop
Mostrar comentarios más antiguos
Hi
I have been working with while and for loops, and I want to know how to transpose or change a while loop to a for loop and vise versa
I need your help with this.
Thank you
2 comentarios
James Tursa
el 18 de Jun. de 2020
What have you tried so far? What problems are you having with this homework assignment?
Danny Maefengea
el 18 de Jun. de 2020
Editada: madhan ravi
el 18 de Jun. de 2020
Respuesta aceptada
Más respuestas (1)
Anish Walia
el 18 de Jun. de 2020
The for loop for your while loop would be
% 0:2:20 will produce a matrix starting at 0, with increment step of 2 in each iteration and will go till 20
for x=0:2:20
disp(x);
end
For more information on loops refer to the following:
1 comentario
Danny Maefengea
el 18 de Jun. de 2020
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!