MATLAB: Add value in column to previous

for loopmatrix arraysum

data_input=[1;1;1;1;1;1;1]
data_output=[1;2;3;4;5;6;7]
how can i achieve this with a for loop? basically take the preceding value and add it to the next one and then repeat as new values emerge.

Best Answer

a=[1 1 1 1 1]
b=cumsum(a)