cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

Parse in substitute

In Substitute, if I don't have a fixed number of symbols, is it possible to use a for loop and parse to generate the symbol names?

Something is wrong here:

 

myExpr=Expr(sum());
For( i=1, i<=10, i++, Insert Into (myExpr,parse("__x"||Char(i)||"__")));
Show(NameExpr(myExpr));
For( i=1, i<=10, i++, substitute (Name Expr(myExpr),parse("__x"||Char(i)||"__"),parse("y"||Char(i))));
Show(NameExpr(myExpr));
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Parse in substitute

You aren't updating the value of myExpr

Names Default To Here(1);

myExpr = Expr(Sum());
For(i = 1, i <= 10, i++,
	Insert Into(myExpr, Parse("__x" || Char(i) || "__"))
);
Show(Name Expr(myExpr));
For(i = 1, i <= 10, i++,
	myExpr = Substitute(Name Expr(myExpr), Parse("__x" || Char(i) || "__"), Parse("y" || Char(i)))
);
Show(Name Expr(myExpr));
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Parse in substitute

You aren't updating the value of myExpr

Names Default To Here(1);

myExpr = Expr(Sum());
For(i = 1, i <= 10, i++,
	Insert Into(myExpr, Parse("__x" || Char(i) || "__"))
);
Show(Name Expr(myExpr));
For(i = 1, i <= 10, i++,
	myExpr = Substitute(Name Expr(myExpr), Parse("__x" || Char(i) || "__"), Parse("y" || Char(i)))
);
Show(Name Expr(myExpr));
-Jarmo
hogi
Level XIII

Re: Parse in substitute

oh, so close!

Recommended Articles