Hello
can someone please help me with this challenge.
matrix
B = [1, 4, 3, 1, 3, 2, 1, 0, 0, 1, 5, 6, 9, 1, 3] % B is Input Matrix
A = cumsum (B);A = [1, 5, 8, 9, 12, 14, 15, 15, 15, 16, 21, 27, 36, 37, 40] % A is output Matrix, which cumulates values in Vector B
C = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] % B is also Output, initial with zero in all vallues.
Then i want A and C to act like this
A = [1, 0, 3, 4, 0, 2, 3, 3, 3, 4, 0, 0, 0, 1, 3] % Every time it exceds 5, the value has to be moved to C, and restart the accumulation from 0
C = [0, 5, 0, 0, 7, 0, 0, 0, 0, 0, 9, 6, 9, 0, 0]
Best Answer