How do you write a loop for a variable that will list 6 rows but you want the equation to apply for those 6 rows and 30 rows after each of them
1 view (last 30 days)
the variable "RA4" contains 6 rows that indicate where a perturbation starts.
RA4 = 5721, 51164, 69680, 98014, 118377, 130204.
I am trying to write a loop that will apply the
XError equation -> abs(COMArray(:,1))-abs(New_COM(:,1));
to each of those RA4 rows and the next 30 for each. Meaning (5721:5751), etc. How can I write that?
dpb on 3 Aug 2022
You'll have to have some indexing expression to compute a place to put the results -- and how to keep track of which part goes where...that's that the "?" placeholder is for--there's where you need an expression -- or you could just have a cell array each of which cells contains the results for each iteration as the quick 'n dirty way out.
The above applies the calculation only to a first column of some array as in your sample code snippet.