Decrementing for loop in MATLAB
Mostrar comentarios más antiguos
Hello everyone,
I am new to MATLAB programming and I want to use a for loop starting with an index 5 and reducing to 1
Example in C++ I can write for int i = 5;i<=1;i--)
how can this be implemented in MATLAB
Respuesta aceptada
Más respuestas (2)
yagnesh
el 29 de Nov. de 2012
5 votos
for i= 5:-1:1 %here we have used reverse for loop to overcome with error statement end
1 comentario
dhrumil sheth
el 25 de Mayo de 2016
Very Good. It is really helpful for me
It is always a good idea to read the documentation in case of questions:
There you find a corresponding example.
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!