Editable matrix script module<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />I'm trying to input an editable matrix using the script module but I can't seem to figure out how to get it done. Below is an example of what I'm trying to do.
Use number edit box, text edit box, or something similar to input the following: [1,2,3,4,5,6]
I want this to be a matrix when I execute a function. I want this inputted matrix to be assigned to a variable so that I can grab certain values from it depending on it's location it the matrix.
The issue I've run into is that the number edit box is only for a numeric value and the text edit box is only for text.
Re: Editable matrix script moduleIt makes little difference, but if you don't like the 'TableBox()' you could also use: tb = HListBox();
Re: Editable matrix script moduleThanks. I was hoping to avoid a table box but this works.
Re: Editable matrix script moduleThere's no 'MatrixEditBox()', but you can (sort of) make one that might suffice:
Names Default To Here( 1 );
nr = 3; // Number of rows
nc = 3; // Number of columns
// Build a 'matrix edit box' from a 'TableBox()' using 'ColEditBox()', populating it with missing values
m = J(nr, nc, .);
nceb = {};
tb = TableBox();
For(c=1, c<=nc, c++,
neb = Number Col Edit Box( "Column "||Char(c), m[0,c] );
InsertInto(nceb, neb);
tb << Append(neb)
);
// Make a window
nw = New Window( "Matrix Edit Box", Outline Box( "Matrix Edit Box", tb, ButtonBox("OK", OKScript)));
// Do something . . .
OKScript =
Expr(
nw << closeWindow;
// Unload the matrix box
m = J(nr, nc, .);
For(c=1, c<=nc, c++,
m[0,c] = Matrix(nceb[c] << get);
);
Show(m);
);