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: Copying data from Matrix to JMP file

News

On June 1, we’re asking you to select a content label when starting a new topic in the Discussions area. Read more to find out why.

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

Highlighted
##

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

Copying data from Matrix to JMP file

Mar 31, 2020 6:31 AM
(961 views)

Hi,

I imported the data from the column properties into a matrix. My question is how can I copy data from matrix into JMP file?

```
Spec2 = Function( {co},
a = Column( co ) << get property( "Spec limits" );
b = a["UL"];
C = Matrix( {b} );
);
```

Copying data from Variable C into JMP file

Any suggestion?

5 REPLIES 5

Highlighted
##

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

Re: Copying data from Matrix to JMP file

There are many ways to move data from a matrix into a JMP Data Table. So the method to use, is really dependent upon what/where you are going to put the matrix data in the data table. A JMP Data Table can be dealt with as if it is just a big two dimensional matrix, several one dimensional matrices, A Column and row, much like Excel, etc.

So in your sample, if you were moving your b matrix into a data table you could specify

```
dt[1,5] = b[1];
// or
Column(1)[5] = b[1];
// or
dt:mySpecs[5] = b[1];
// or
dt << New Column("mySpecs", set values(b));
```

I strongly suggest you read the sections in the Scripting Guide on Matrices in Chapter 7, and all of Chapter 9, which covers Data Table programming.

Help==>JMP Documentation Library...…….Scripting Guide

Additionally, in your sample function, you seem to be pulling out the Upper Spec Limit, from the Spec Limits column property. You are referencing it at "UL". The List element name is "USL"

Jim

Highlighted
##

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

Re: Copying data from Matrix to JMP file

Here's one way to put a 2D matrix into a table:

```
matr = [1 2 3, 4 5 6, 7 8 9];
nr = nrows(matr);
nc = ncols(matr);
dt = new table("Matrix Version", add rows(nr),
new column("c1", numeric, continuous)
);
for (i = 1, i <= nc, i++,
one_col = "c" || char(i);
if (i > 1,
dt << new column(one_col);
);
column(dt, one_col) << set values(matr[1::nc,i]);
);
```

Ditto on RTFM.

Highlighted
##

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

Re: Copying data from Matrix to JMP file

Convert Matrix to Data Table and Back is another answer to converting a matrix to a table.

Craige

Highlighted
##

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

Re: Copying data from Matrix to JMP file

Thanks Craige - where has **AsTable()** been hiding all of my life!!??

Highlighted
##

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

Re: Copying data from Matrix to JMP file

It hides well:

- Does not have "matrix" in its name, needs an alias like MatrixToDataTable.
- Mis-categorized in the scripting index as a row function.
- A matrix is a primitive type in JMP, not an object, so the function is not associated with an object.

@EvanMcCorkle @XanGregg @sheila_loring @Justin_Chilton

Craige