我有一个如下表:
1 2 3 4 5 6 . . . .
1 1 0 0 0 1 0 . . . .
2 0 0 1 1 1 1 . . . .
3 0 1 0 0 0 1 . . . .
4 1 0 0 0 0 0 . . . .
5 0 0 1 0 1 0 . . . .
. . . . . . . . . . .
. . .
. .
.
1,2,.... 是行和列的标题。我需要索引到表中,这意味着:一个数组(向量)索引到包含 1 的 row1 (=列 1,因为在表中 cell(1,1) 为真)。另一个索引到 row2 的数组包含 3,4,5,6(因为单元格 (2,3),(2,4),(2,5),(2,6) 为真)等等...
我阅读了Compact MATLAB matrix indexing notation和Use a vector as a index to a matrix with accuracy,但我无法编写代码使其正常工作。