MATLAB Understanding Matlab's "for" Loop: i = n to j

  • Thread starter Thread starter FrostScYthe
  • Start date Start date
  • Tags Tags
    Loop
Click For Summary
The statement "for i = n:-1:j" in MATLAB defines a for loop that initializes the variable i to n and decrements it by 1 in each iteration until it reaches the value of j. The loop executes its body for each value of i from n down to j. This structure allows for backward iteration within a specified range. For further details, reference the MATLAB documentation on for loops.
FrostScYthe
Messages
80
Reaction score
0
What does this statement mean in matlab?

for i = n:-1:j
 
Physics news on Phys.org

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
5
Views
3K