How do I sort values into quarters?
2 views (last 30 days)
I have a matrix that lists dates and values as below. It goes through days with each value, then repeats for the next person. It is thousands of values long (length=n).
I have date values that correspond to the starting dates of 27 quarters... 733408
I want to create a matrix that is n x 27 where (1,1) will be the value for the first person at date 733499 (Q1), (2,1) will be the second quarter value of the first person. (1,2) will be the first quarter value for the second person.... and so on.
I have some code that I used previously to do a similar command, summing the values for each person within each period. But this time I just want the value on the first day of each quarter. That code was...
quarter_initialvalue(l,j) = quarter_initialvalue(l,j) + ...
format short g
Where 'new_data' was the matrix consisting of each day a value was held for. All the new_data values make up the matrix that is n x 2 listing all days and values for each person.