我将如何修改代码以仅获取排列的唯一值?
x = -1:1;
a = 1:length(x);
[a1,a2] = ndgrid(a);
y = x([a2(:) a1(:)]);
y unique y
-1 -1 -1 -1
-1 0 -1 0
-1 1 -1 1
0 -1 0 0
0 0 0 1
0 1 1 1
1 -1
1 0
1 1