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: Converting numeric text data collected from listbox to a matrix

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

Nov 10, 2017 5:14 PM
(2250 views)

The list data below (LotSlot_Start) was extracted from a list box in an app I am creating. I am trying to turn it into a matrix with of form [14, 13]. The below gives me what I want, but I want to be able to do it for any number of entries.

```
LotSlot_Start = {"14", "13"};
//This gives me what I want: slot_start = [14, 13]
Slot_Start=Matrix(num(lotslot_start[1]));
Slot_Start=v concat(slot_start,Matrix(num(lotslot_start[2])));
show(Slot_Start);
```

I have created this script:

```
//This crashes jmp and I can't figure out why
for(i=1, i=nitems(lotslot_start), i++,
If(i==1, Slot_Start=Matrix(num(lotslot_start[i])));
If(i>1, Slot_Start=v concat(slot_start,Matrix(num(lotslot_start[i]))));
);
show(Slot_Start);
```

But it always crashes JMP when I try to run it. I can't figure out why. Any help would be appreciated.

Thanks,

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

That is what I get for getting distracted before hitting send. Glad you figured it out..

3 REPLIES 3

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

Re: Converting numeric text data collected from listbox to a matrix

Highlighted
##

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

Re: Converting numeric text data collected from listbox to a matrix

The second argument of the for loop needs to less than or equal to, right now it is false for the first value of i.

`for(i=1, i<=nitems(lotslot_start), i++,`

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

That is what I get for getting distracted before hitting send. Glad you figured it out..