I have loop where N=50. inside the loop I have array (vector). my condition is: if i mod 10 == 0, then saving value of summation in a vector. So after finish the loop we expecting to have 5 values stored in a vector. How can I do that without storing all 50 values.
My Example:
my vector will save (0 0 0 0 0 0 0 0 0 20 0 0 0 ...). I just want to save only 20 in the first row then repeat it 5 times. I have to use N=50 not 5. is that possible?
It is easy with shift registers: use one to pass the array being built from one iteration to the other, and test the i%10==0
in a case structure. On true
append the current value to the array, else don't modify it.