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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

"match" function: what to do with the ( ) result?

ptc-4310378
1-Newbie

"match" function: what to do with the ( ) result?

The "match" function returns a result in ( ).

I would have liked to use the value returned by "match" as an index, but if I try to assign the "match" result to a variable, the variable is flagged as "undifined" when called further down the road.

"Help" is not much help on that.

Is there a way to make usage of the (value) returned by "match", or can this function be used for informational purpose only?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
MikeArmstrong
5-Regular Member
(To:ptc-4310378)

Yes, write match(z)[0

See if that works.

Mike

View solution in original post

6 REPLIES 6
MikeArmstrong
5-Regular Member
(To:ptc-4310378)

Yes, write match(z)[0

See if that works.

Mike

Mike Armstrong wrote:

Yes, write match(z)[0

See if that works.

Mike

with the caveat that this will return the first match - it may be worth checking if there are other values in match.

Stuart

MikeArmstrong
5-Regular Member
(To:StuartBruff)

Good point, but Laurent did say value.

Mike

monotonous set of data......so in my case [1 works great.

I guess the answer would have been obvious to me if there had been multiple matches......

Many thanks.

MikeArmstrong
5-Regular Member
(To:ptc-4310378)

Maybe, match returns a vector even if only one match is found.

Mike

MikeArmstrong
5-Regular Member
(To:ptc-4310378)

LIke below if you have a single match.

Clipboard01.jpg

Mike

Top Tags