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 create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

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

JMP adding characters to string?

Hi all,

I had some code that extracted some numbers into variables, and then I put them together in a string.

xlocation = dt1:Die_X[x];          

ylocation = dt1:Die_Y[x];

site = dt1:Site[x];

deviceName = "x="||char(xlocation)||" y="||char(ylocation)||" Site"||char(site);

It would output something like this:  x= 8 y=2 Site2

But now it outputs this:  x=[8] y=[2] Site[2]

I am not sure what I changed.  The columns in the data table where I am extracting the variables are Numeric columns. 

Does anyone have any ideas why this might be happening?  Also, I am having trouble finding an example of how to use the remove from character function.

Something like this?  xlocation = Remove From(xlocation, [)?

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: JMP adding characters to string?

What's the value of x?  It seems that it's a list or matrix of numbers, which is then returning a matrix back to xlocation, ylocation and site.

Might have to insert logic to test x.  If it's a matrix extract the first value and use that.

a = [1];

b = char(a);

print(b);

"[1]"

View solution in original post

3 REPLIES 3
pmroz
Super User

Re: JMP adding characters to string?

What's the value of x?  It seems that it's a list or matrix of numbers, which is then returning a matrix back to xlocation, ylocation and site.

Might have to insert logic to test x.  If it's a matrix extract the first value and use that.

a = [1];

b = char(a);

print(b);

"[1]"

Craige_Hales
Super User

Re: JMP adding characters to string?

Is the column a JMP 12 expression column holding a matrix?

Here's a debugging idea that might shed some insight.  The type() function will tell you the data type of the value in a JSL variable.

x=42;

show(x,type(x),char(x));

x=[3.14];

show(x,type(x),char(x));

x = 42;

Type(x) = "Number";

Char(x) = "42";

x = [3.14];

Type(x) = "Matrix";

Char(x) = "[3.14]";

Craige
natalie_
Level V

Re: JMP adding characters to string?

Thanks PMroz and Craige,

It was a matrix.  No idea why it suddenly changed to a matrix though.

Recommended Articles