Subtraction for Matrix of Different Length
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponse acceptée
Andrei Bobrov
le 28 Oct 2013
Modifié(e) : Andrei Bobrov
le 28 Oct 2013
[a,b] = setdiff(x,y,'rows');
[~,ii] = sort(b);
out = a(ii,:);
or
lb = ismember(x,y,'rows');
out = x(~lb,:);
0 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!