What is the most efficient way of generating
>> A
A =
0 1 1
1 1 0
1 0 1
0 0 0
with
>> B = [2 3; 1 2; 1 3]
B =
2 3
1 2
1 3
in MATLAB?
E.g., B(1, :)
, which is [2 3]
, means that A(2, 1)
and A(3, 1)
are true
.
My attempt still requires one for loop, iterating through B
's row. Is there a loop-free or more efficient way of doing this?