Maybe the title sounds vague, but I'll try to explain. I have the following vector of size samples-by-1 that contains the numerical values between 0 and 9 (10 values):
V = [3;5;1;2;6;9;7;8;4;0]
Now I want to create a 'logical' matrix from this. So like this:
0 1 2 3 4 5 6 7 8 9 M = [0 0 0 1 0 0 0 0 0 0; 0 0 0 0 0 1 0 0 0 0; 0 1 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 0 0 0; 0 0 0 0 0 0 0 0 0 1; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 1 0 0 0 0 0; 1 0 0 0 0 0 0 0 0 0]
What's the easiest way to achieve this?
Best Answer