cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to use Accelerated Life Testing (ALT) to evaluate reliability. Register for June 5 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
cchueng
Level IV

Extract String which has positive and negative numbers

Hi,

I have a table1.jmp as atteched. How do I extract the X and Y as circled in the red box? The X and Y values can sometimes be negative. For example, the XY values from the 1st row is -280,-396. The XY values from the 2nd row is 284,-228.

cchueng_0-1744749768432.png

 

3 REPLIES 3
cchueng
Level IV

Re: Extract String which has positive and negtive numbers

This is a tough one. Any wise advice?

txnelson
Super User

Re: Extract String which has positive and negtive numbers

Here are the formulas that will do what you want

// For the X value
Num( Substitute( Word( 5, Substitute( :Fname, "--", "-&" ), "-" ), "&", "-" ) )

// For the Y value
Num( Substitute( Word( 6, Substitute( :Fname, "--", "-&" ), "-" ), "&", "-" ) )

txnelson_0-1768422481962.png

 

Jim
jthi
Super User

Re: Extract String which has positive and negtive numbers

Regex can also be an option (https://regex101.com/r/5fgzrx/1 for partial explanation on how this works)

Num(Regex(:Fname, "-(-?\d{3})-(-?\d{3})", "\1"))

change "\1" to "\2" for Y

jthi_0-1768939456727.png

 

-Jarmo

Recommended Articles