私は位置行列を持っています:
positionMatrix = [1 2 3; 1 3 2; 2 1 3];
次のように配列を生成する単純な実装 (for ループなし) が必要です。
% there are 3 lines in positionMatrix, so it should generates 3 arrays of ones
array 1 should be [1 0 0; 0 1 0; 0 0 1] %from positionMatrix 1 2 3
array 2 should be [1 0 0; 0 0 1; 0 1 0] %from positionMatrix 1 3 2
array 3 should be [0 1 0; 1 0 0; 0 0 1] %from positionMatrix 2 1 3
positionMatrix は M x N (M は N に等しくない) である可能性があります。