Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有以下矩阵
B = 0 1 0 0 0 1 0 1 1 0 0 0 1 1 1 0
我想返回第一个值为“0”且第四个值为“1”的列的索引。在这种情况下,这将是(1, 3).
(1, 3)
如何在 MATLAB 中获得预期的输出?
你可以使用
find(B(1,:) == 0 & B(4,:) == 1)
这导致
ans = 1 3