One solution:
Any boolean matrix:
m←4 3⍴?12⍴2
m
0 0 1
0 0 0
1 1 0
0 1 0
Note its shape:
d←⍴m
d
4 3
Ravel the matrix into a vector:
v←,m
v
0 0 1 0 0 0 1 1 0 0 1 0
Generate indices:
i ←⍳⍴v
i
0 1 2 3 4 5 6 7 8 9 10 11
Construct a matrix for each 1 in the original matrix:
a←d∘⍴¨↓(v/i)∘.=i
a
0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 0
Verify result:
↑∨/a
0 0 1
0 0 0
1 1 0
0 1 0
There is probably a nice way to do this using scatter point indexing as well, by first generating a 3 dimensional matrix and then specifying the location of the 1s.
Yes there is, using v and d as above:
n←+/v
b←(n,d)⍴0
b[↓⍉(⍳n)⍪d⊤v/⍳⍴v]←1
b
0 0 1
0 0 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
0 0 0
0 0 0
0 1 0
∨⌿b
0 0 1
0 0 0
1 1 0
0 1 0