I have an array of labels in the form:
[1;3;2;]
I wish to convert this to an array of vectors, where only the i'th element is 1, and the rest are 0's.
So the above would be (assuming 5 lables):
[1 0 0 0 0]
[0 0 1 0 0]
[0 1 0 0 0]
How can this be done, without a 'for' loop?
A=[1;3;2]; eye(5)(A,:). – Erick Wong Jun 07 '13 at 22:53