cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Programming question

aagic
1-Visitor

Programming question


I have a matrix with two columns. The first column is sorted and there are repeating elements in the first column with the corresponding elements in the second column.

I want to keep the element from the first column that have lowest value in the second column, the rest should be deleted. So there should be no repeating elements in the first

column and the element that is kept has lowest number in the second column.( compared to its repeated elements ).

Anyone who has an alghoritm for that or ideas ?

ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
23-Emerald III
(To:aagic)

aagic wrote:


I have a matrix with two columns. The first column is sorted and there are repeating elements in the first column with the corresponding elements in the second column.

I want to keep the element from the first column that have lowest value in the second column, the rest should be deleted. So there should be no repeating elements in the first

column and the element that is kept has lowest number in the second column.( compared to its repeated elements ).

Anyone who has an alghoritm for that or ideas ?

Do you mean something like the attached?

(caveat: I haven't checked it, I've just sneaked it together whilst waiting for my PC to do something else work-related ...)

Stuart

View solution in original post

2 REPLIES 2
StuartBruff
23-Emerald III
(To:aagic)

aagic wrote:


I have a matrix with two columns. The first column is sorted and there are repeating elements in the first column with the corresponding elements in the second column.

I want to keep the element from the first column that have lowest value in the second column, the rest should be deleted. So there should be no repeating elements in the first

column and the element that is kept has lowest number in the second column.( compared to its repeated elements ).

Anyone who has an alghoritm for that or ideas ?

Do you mean something like the attached?

(caveat: I haven't checked it, I've just sneaked it together whilst waiting for my PC to do something else work-related ...)

Stuart

Hi Stuart,

it seams to be correct. Excellent, thanks !!

Adnan

Announcements

Top Tags