I have a m-dimensional vector of integers ranging from 1 to n. These integers are column indexes for m × n matrix.
I want to create a
In Octave, at least as of 3.6.3, you can do this easily using broadcasting:
M = v==1:4