Subtraction for Matrix of Different Length

1 次查看(过去 30 天)
x=[19 6 7; 45 9 11; 1 4 3; 9 7 6; 4 3 7; 44 1 7];
y=[1 4 3; 9 7 6];
How can I compute x-y?
The remains would be:
remains=[19 6 7; 45 9 11; 4 3 7; 44 1 7]
Thanks in advance.

采纳的回答

Andrei Bobrov
Andrei Bobrov 2013-10-28
编辑:Andrei Bobrov 2013-10-28
[a,b] = setdiff(x,y,'rows');
[~,ii] = sort(b);
out = a(ii,:);
or
lb = ismember(x,y,'rows');
out = x(~lb,:);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by