how can i delete every row with the same number?

2 views (last 30 days)
C =
2 4
2 4
2 2
2 2
3 1
3 4
2 4
3 4
4 3
>> e = unique(C, 'rows')
e =
2 2
2 4
3 1
3 4
4 3
if a have rows with the same numbers with unique(C, 'rows') i delete them but how can i delete every row with the same number?
for example
2 2
thank you

Accepted Answer

Image Analyst
Image Analyst on 24 Jan 2014
Try this:
C =[...
2 4
2 4
2 2
2 2
3 1
3 4
2 4
3 4
4 3]
% Delete row if first element in a row
% equals the second element. (Must be integers).
rowsToDelete = C(:,1)==C(:,2)
C(rowsToDelete,:) = []

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!