i have a vector as
v = [ 1 1 1 2 2 2 3 3 4]
i wanted to create a new matrix as
M = [ 1 1 1 0 0 0 0 0 0; 0 0 0 1 1 1 0 0 0;0 0 0 0 0 0 1 1 0;0 0 0 0 0 0 0 0 1];
how to do it?
matrix manipulation
v = [ 1 1 1 2 2 2 3 3 4]
M = [ 1 1 1 0 0 0 0 0 0; 0 0 0 1 1 1 0 0 0;0 0 0 0 0 0 1 1 0;0 0 0 0 0 0 0 0 1];
Best Answer