how can i delete every row with the same number?

1 次查看(过去 30 天)
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

采纳的回答

Image Analyst
Image Analyst 2014-1-24
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,:) = []

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by