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.
我有一个矩阵,这个矩阵的某些行重复了两次。我需要删除重复的行才能得到一个满秩矩阵。我可以用循环来做到这一点吗?
MATLAB中是否有执行此操作的函数?
尝试unique,'rows'作为第二个输入:
unique
'rows'
x = unique(x,'rows');
或者:
[~, idx] = unique(x,'rows'); y = x(sort(idx),:);
第二种方法让您保持原始顺序。