Hello Everyone, I'm looking for your help for the following problem
Show older comments
Use the matrix given on the first link.I need a matlab code that can generate on the second link. Thanks!
5 Comments
Image Analyst
on 5 Mar 2018
Keyre
on 5 Mar 2018
Akira Agata
on 5 Mar 2018
What is the rule to chose one value for each column?
Keyre
on 5 Mar 2018
Jan
on 5 Mar 2018
@Keyre: I do not understand your explanations.
Accepted Answer
More Answers (1)
Fangjun Jiang
on 5 Mar 2018
I'll provide a lead. I think the rest should be relatively easy.
A = [17 14 18 15 14 19;...
1 5 3 30 8 14;...
20 2 16 7 13 11];
[~,IndexMatrix]=sort(A,'descend');
IndexMatrix =
3 1 1 2 1 1
1 2 3 1 3 2
2 3 2 3 2 3
The first row of IndexMatrix is what you need to work on. Starting from the third column, do a loop, compare it with all the previous number to see if it occurs twice already. If it does, replace it with the number in the same column but next row in IndexMatrix. You need to do this in a while-loop because the next number could also occur twice already, although in this one case, it didn't happen.
1 Comment
Keyre
on 6 Mar 2018
Categories
Find more on Logical 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!