MATLAB: Divide group into subgroups

groupssubgroups

I have a matrix 5×5 and i managed from this matrix to create a matrix 5×10 by creating a subgroup of 2 in each column.
So Matrix =
0 0 0 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 1
I want to tell that row 1 belongs to group 2, row 2 belongs to group 1, row 3 belongs to group 2, row 4 belongs to group 3 and row 5 belongs to group 5!
Thank you so much

Best Answer

group=[2 1 2 3 5]
the variable group indicate what you want