Skip to main content
Best answer by Werner_E

@NM_10165576 wrote:

How to apply this program, when the vector has two columns.


If the "vector" has two columns, its no longer a vector but a general matrix 🙂

 

 


Reference topic: https://community.ptc.com/t5/Mathcad/How-to-remove-duplicate-entries-in-an-array-using-a-program/m-p/996692 

Somehow your link refers back to this very thread which sure was not intended.

 

I guess you meant this thread: Solved: How to remove duplicate entries in an array using ...

 

The "match" functions only works with a scalar value as its first argument (the value match should  look for) and so the variante offered in that thread don't work.

You may use a simple straight forward solution to remove duplicate rows from a matrix:

Werner_E_0-1738687859334.png

Of course it does not only work on two column matrices

Werner_E_1-1738687923326.png

but for matrices of all dimensions

Werner_E_2-1738687981441.png

and so also for vectors (= 1-column matrices) as well 😉

Werner_E_4-1738688167989.png

 

Remark; I assumed that you wanted to remove duplicate rows of a matrix.
If your intention was to remove rows with duplicate values in just one column (maybe the first column) - disregarding the values in the other columns, you sure could use a program similar to the ones provided in the thread you intended to link to.

Werner_E_0-1738689277696.pngWerner_E_1-1738689307673.png

 

BTW, none of the version would work OK if the matrix contains NaN's, because you can't check NaN's for equality - the result would always be "not equal":

Werner_E_0-1738691139953.png

NaN is also not seen as a scalar which is why "match" fails and thats the reason for the "matchNaN" function

Werner_E_1-1738691298423.png

 

 

 

 

Prime 10 sheet attached

2 replies

21-Topaz II
February 4, 2025

Please enclose your worksheet?

Werner_E25-Diamond IAnswer
25-Diamond I
February 4, 2025

@NM_10165576 wrote:

How to apply this program, when the vector has two columns.


If the "vector" has two columns, its no longer a vector but a general matrix 🙂

 

 


Reference topic: https://community.ptc.com/t5/Mathcad/How-to-remove-duplicate-entries-in-an-array-using-a-program/m-p/996692 

Somehow your link refers back to this very thread which sure was not intended.

 

I guess you meant this thread: Solved: How to remove duplicate entries in an array using ...

 

The "match" functions only works with a scalar value as its first argument (the value match should  look for) and so the variante offered in that thread don't work.

You may use a simple straight forward solution to remove duplicate rows from a matrix:

Werner_E_0-1738687859334.png

Of course it does not only work on two column matrices

Werner_E_1-1738687923326.png

but for matrices of all dimensions

Werner_E_2-1738687981441.png

and so also for vectors (= 1-column matrices) as well 😉

Werner_E_4-1738688167989.png

 

Remark; I assumed that you wanted to remove duplicate rows of a matrix.
If your intention was to remove rows with duplicate values in just one column (maybe the first column) - disregarding the values in the other columns, you sure could use a program similar to the ones provided in the thread you intended to link to.

Werner_E_0-1738689277696.pngWerner_E_1-1738689307673.png

 

BTW, none of the version would work OK if the matrix contains NaN's, because you can't check NaN's for equality - the result would always be "not equal":

Werner_E_0-1738691139953.png

NaN is also not seen as a scalar which is why "match" fails and thats the reason for the "matchNaN" function

Werner_E_1-1738691298423.png

 

 

 

 

Prime 10 sheet attached

13-Aquamarine
February 5, 2025

This program works. Thank you for the reply.

25-Diamond I
February 5, 2025

@NM_10165576 wrote:

This program works. Thank you for the reply.


Fine, you are welcome.

If you don't have any further questions to this topic you may consider closing the thread.