remove equal items without loop

hi, I want to remove any two item are equal without loop x=[1 2 3 5]; y=[4 3 1 6 7]; I want the result be x=[2 5] y=[4 6 7] how do that? thanks

 Réponse acceptée

Wayne King
Wayne King le 28 Mar 2012

3 votes

[~,inx,iny] = intersect(x,y);
x(inx) = [];
y(iny) = [];

Plus de réponses (1)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by