フィルターのクリア

Subtraction for Matrix of Different Length

1 回表示 (過去 30 日間)
RDG
RDG 2013 年 10 月 28 日
編集済み: Andrei Bobrov 2013 年 10 月 28 日
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 Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by