Check if matrix has two identical rows

43 views (last 30 days)
Hi everyone, I wanted to check if a matrix has two identical rows. But i cant create a code that can do that. I was wondering if anyone has any idea on how to do that?

Accepted Answer

Dr. Seis
Dr. Seis on 4 Jan 2012
If you want to remove identical rows, then
B = unique(A,'rows');
As a check, if size(B) ~= size(A), then you have at least two identical rows.

More Answers (1)

Sean de Wolski
Sean de Wolski on 4 Jan 2012
doc unique
specifically look at the 'rows' option.


Find more on Loops and Conditional Statements 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!

Translated by