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.
行1==xに項目があり、行2==yに項目がある列を検索する行列があります。これを行うための最速の方法は何ですか?ありがとう、CP
検討:
colIdx = all( bsxfun(@eq, M([row1 row2],:), [x;y]) );
これは、2 つ以上の行を一致させたい場合に柔軟です。
これは、特定の行列Mと行のインデックスrow1で機能するはずrow2です。
M
row1
row2
columnIndices = find((M(row1,:) == x) & (M(row2,:) == y));