How to easily detect all the equal rows of an array with saving the indices of the elements?
1 次查看(过去 30 天)
显示 更早的评论
I have a matrix as shown here
A=[ -1 0 0;
-1 0 0;
-1 0 0;
-1 0 0;
1 0 0;
1 0 0;
] I want to detect all the equal rows in the matrix and build another matrix with the indices of the equal rows. For exemple here row1=rows2=row3=row4 and row5=row6... I want to have a matrix like this [1 2;1 3;1 4; 5 6]. I find a solution but it uses a lot of for loops so it's not fast enough when I apply it to a large matrix. Is there any easiest solution for this. Thank you.
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!