Subscribe Bookmark RSS Feed

JMP adding characters to string?

natalie_

Community Trekker

Joined:

Jan 6, 2016

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
Solution

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]"

3 REPLIES
Solution

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

Staff

Joined:

Mar 21, 2013

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_

Community Trekker

Joined:

Jan 6, 2016

Thanks PMroz and Craige,

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