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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Programming question

aagic
1-Newbie

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 ?

1 ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
23-Emerald II
(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 II
(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

Top Tags