MATLAB: How to apply the same function on different rows of a vector

intervalsloopmatrix

Hello everyone,
I'm trying to apply a simple function to different rows of a vector 521×1. I want to divide the row 521 for 100 and then do the same for the row 501, 481, 461…basically every 20 rows I need to apply this division. At the end I expect to obtain a vector 26×1.
Could someone help me?
Thank you

Best Answer

If I got the question right, this is how it should work:
andr = randn(521,1)
andrn = 1/100*andr(521:-20:1) % you can use 1/100.*(andr(521:-20:1,:)) in case there are more columns
The code will give the last value (on 521st row) first as you mentioned in the question.
Related Question