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.
(首先,标题真的很模糊 - 但我想不出更好的方法来问我的问题。请随时编辑标题,然后删除此注释。)
假设我有一个矩阵ref:
ref
>> ref ref = 40 20 90 30
我有一个矩阵permuted:
permuted
>> permuted permuted = 20 40 30 90
有没有产生idx这样的矩阵的操作isequal(ref, permuted(idx))?在这种情况下,idx == [2 1 4 3]。
idx
isequal(ref, permuted(idx))
idx == [2 1 4 3]
你需要的是ismember:
ismember
[tf, idx] = ismember(ref, permuted);
对于您的示例,这确实会产生:
idx = 2 1 4 3