FInding duplicates in matrices
3 ビュー (過去 30 日間)
Dear experts, Given square matrix M, I would like to detect the position of the first duplicate. I have made the code such that it'll be able to do that across the columns, but there is something wrong somewhere in the code that shows even those who aren't duplicates and I am not sure how to fix it. Could you help point that out if possible, please? Thank you!
fprintf('Duplicate value(%d) found at row: %d, column: %d\n',board(ii,jj),ii,jj)
回答 (1 件)
Honglei Chen 2012 年 6 月 26 日
In your program, your element under test is board(jj,ii) while in the result, you are using board(ii,jj),so they are not consistent.On the other hand, your code only looks for duplicates within a column, is this what you want?