Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Re: JMP adding characters to string?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 15, 2016 7:40 AM
(5493 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: JMP adding characters to string?

Thanks PMroz and Craige,

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