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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Translate the entire conversation x

Match numbers betweeen two arrays to get the index

fahmed-2
14-Alexandrite

Match numbers betweeen two arrays to get the index

Hello,

 

I have two arrays H and H_end.Pile_vec.total. I am trying to match the numbers between these two arrays and get the corresponding index number from H_end.Pile_vec.total. I have used the match function whic works for the first one only and not for the rest. Please help. My version is Prime 10.

fahmed2_0-1753293981943.png

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:fahmed-2)

Hmmm, that way?

Werner_E_0-1753296704437.png

or maybe better

Werner_E_1-1753296807888.png

in case all values in H are to be found in H.end.Pile

 

 

View solution in original post

4 REPLIES 4
Werner_E
25-Diamond I
(To:fahmed-2)

Its not clear what you mean by "match the numbers between these two arrays".

The error you get is easy to explain:

Werner_E_0-1753294681533.png

You will only find a match for the first three values in H and you can trap the error using "try...on error.."

Werner_E_1-1753294915353.png

 

So you would have to explain in more detail what you actually are trying to achieve.

 

fahmed-2
14-Alexandrite
(To:Werner_E)

Thanks @Werner_E . This is what I needed. Based on H_end.Pile_vec.total, it will match with H and extract the indexes. How to stop at the last found index and not to show "NaN"s. Also, would later extract the arrays as values.

 

Thanks

Werner_E
25-Diamond I
(To:fahmed-2)

Hmmm, that way?

Werner_E_0-1753296704437.png

or maybe better

Werner_E_1-1753296807888.png

in case all values in H are to be found in H.end.Pile

 

 

fahmed-2
14-Alexandrite
(To:Werner_E)

Thank you so much @Werner_E 

Announcements

Top Tags