![]() |
如何在不进行MATLAB排序的情况下从A中删除集合A和B的交集?
两个矩阵A和B:
A = [1 2 3 9 7 5 4 9 4 1 4 7] B = [1 2 3 1 4 7] 矩阵B的所有行都是矩阵A的成员。我希望从A中删除A和B的公共行,而不进行排序。 我尝试过setdiff(),但这对输出进行排序。 对于我的特定问题(蛋白质结构中的原子坐标),保持行的有序完整性很重要。 [B]回答:[/B] 使用[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/ismember.html"]ISMEMBER[/URL] : %# find rows in A that are also in B commonRows = ismember(A,B,'rows'); %# remove those rows A(commonRows,:) = []; [url=https://stackoverflow.com/questions/3467670]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 20:39。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.