Need to remove elements which repeated 2 times
1 view (last 30 days)
Show older comments
I have
A=[1 2; 1,3; 1,4; 1,5; 2,3; 3,6; 4,5; 5,6];
element 2, 4, 6 repeated 2 times. I want to remove them from A.
A_new=[1,3; 1,5]
Accepted Answer
Alex Mcaulley
on 3 Mar 2020
A=[1 2; 1,3; 1,4; 1,5; 2,3; 3,6; 4,5; 5,6];
N=max(max(A));
A_new = A;
for i=1:N
if sum(sum(A==i),2)==2
A_new(any(ismember(A_new,i),2),:)=[];
end
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Link to Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!