I want to convert a vector of integers into a logical matrix. This is how I want to do it. Let's say the vector is of size M, and the maximum element is A. The output should be a logical matrix of size MxA, where each row with value v_i is 0 from column 1 to (v_i - 1), and is 1 from column v_i to A. Here's an example:
3
4
4
1
The output should be:
0 0 1 1
0 0 0 1
1 1 1 1
1 1 1 1
I can do this quite easily with a loop but is there a loop-less way to do it in MATLAB?