find repetition in matrix

Its OK.Thanks. if you are still interested:
2 82 10 16 15 66 76 71 83 44 49
4 91 28 98 43 4 75 4 70 39 45
4 13 55 96 92 85 40 28 32 77 65
1 92 96 49 80 94 66 5 96 80 71
1 64 97 81 96 68 18 10 4 19 76
I want the prog. to check each element of the first column.if it is not repeted,then take the first k large numbers of the row along with their indices and put them in matrix. if not take the first large k numbers and give them to the first repeat then give the rest to the next one. I think the condition must include sort command

5 Comments

What is the expected result for your example?
It's already been answered and accepted in his duplicate post: http://www.mathworks.com/matlabcentral/answers/124704#answer_132448
@yousef Yousef: I do not understand the question. What does this mean:
take the first k large numbers of the row along with their indices and put them in matrix
and
take the first large k numbers and give them to the first repeat then give the rest to the next one
Please do not open multiple threads for one problem, because this wastes the time of the readers.
2 is not repeated so ,find the maximum four(let k=4) numbers of this row. 4 is repeated so,find the first 4 maximum numbers and put them in one row.the next 4 large put them in other row. and so on. the result should look like: x=
2 9 2 7
4 2 7 9
4 5 6 10
3 9 6 2
3 5 4 11
where these numbers are indices of largest numbers from each row
The max 4 numbers in the first row (other than column 1) are 83, 82, 76, 71, occurring at indexes 9, 2, 7, and 8. Your first row does not look like either of those sets of numbers. Your algorithm for 4 is even more confusing. Where on earth did you come up with this wild scheme for rearranging numbers? And can you explain it any better because I'm not getting your rows. I would have the first row as [83, 82, 76, 71] or [9, 2, 7, and 8] according to your explanation of taking the 4 max values, though I'm not sure in what order those numbers go. Anyway, they don't match your first row of [2,9,2,7].

Sign in to comment.

Answers (0)

Categories

Asked:

on 6 Apr 2014

Commented:

on 7 Apr 2014

Community Treasure Hunt

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

Start Hunting!