How to substract a loop from the first 10 cell values of the loop?

1 view (last 30 days)
Hi everyone,
I have a loop which reads an excel file and calculates some stuff and read a value to cells in a row
For n= 1:200
X(1,n) = C(1,2)
X(2,n) = X(1,n)- [ X(1,n) I want this tem remain constant in pattern of 10. For instance, X(1,101)-X(1,1), X(1,102) - X(1,2) up to ten and again X(1,111)-X(1,1), X(1,112)-X(1,2) ....)
end of n
Could you please help me to get this done. Thank you!

Accepted Answer

Jorg Woehl
Jorg Woehl on 11 Mar 2021
Would this work?
X(2,n) = X(1,n) - X(1,mod(n-1,10)+1)

Sign in to comment.

More Answers (0)


Find more on Loops and Conditional Statements in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!