这可能很简单,但我看不到它。有没有办法在不枚举所有A(i)的情况下构造矩阵B(下面)?
A = [0 0 1 2 0 1];
>> B = [A == A(1);A == A(2);A == A(3);A == A(4);A == A(5);A == A(6)]
B =
1 1 0 0 1 0
1 1 0 0 1 0
0 0 1 0 0 1
0 0 0 1 0 0
1 1 0 0 1 0
0 0 1 0 0 1
答案 0 :(得分:3)