Copying data from Matrix to JMP fileHi,
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?
Re: Copying data from Matrix to JMP fileIt 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
Re: Copying data from Matrix to JMP fileThanks Craige - where has AsTable() been hiding all of my life!!??
Re: Copying data from Matrix to JMP fileConvert Matrix to Data Table and Back is another answer to converting a matrix to a table.
Re: Copying data from Matrix to JMP fileHere'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.
Re: Copying data from Matrix to JMP fileThere 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"