Are there any efficient way to do the following?
I have this vector:
0.923
0.757
0.552
0.298
0.079
0.925
0.769
0.565
0.297
0.075
0.927
0.777
0.572
0.294
0.072
0.931
0.778
0.57
0.292
0.07
0.933
0.78
0.566
0.293
0.075
I want to split this vector to smaller vectors each one consist of 5 values, and adding 1 in the top and 0 at the end of each vector like this:
1
0.923
0.757
0.552
0.298
0.079
0
1
0.925
0.769
0.565
0.297
0.075
0
1
0.927
0.777
0.572
0.294
0.072
0
1
0.931
0.778
0.57
0.292
0.07
0
1
0.933
0.78
0.566
0.293
0.075
0
can I use cumsum to find the difference between value 1 and 2 in the same vector ? for example, the first vector 0.923 - 1 = 0.077 and form another vector with the answers ?