Create matrix A with 3 rows and 2 columns:
A = [1 2, 3 4, 5 6];
R is a row vector and C is a column vector:
R = [10 12 14];
C = [11, 13, 15];
B is a 1-by-1 matrix, or a matrix with one row and one column:
B = [20];
E is an empty matrix:
E = [];
J( 0,4 );
[](0,4)
 
[]( 5,0 )
[](5,0)
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
data = []( 0, 2 );
For Each Row( data |/= Matrix( {{dt:height, dt:weight}} ) );
Show( data );
data = [59 95, 61 123, 55 74,...]
A script can return an empty matrix. In Big Class.jmp, the following expression looks for rows in which age equals 8, finds none, and returns an empty matrix:
a = dt << Get Rows Where( age == 8 );
Show( a );
a = [](0,1);
If you want to convert lists into a matrix, use the Matrix() function. A single list is converted into a column vector. Two or more lists are converted into rows.
A = Matrix( {1, 2, 3} );
[1,2,3]
A = Matrix( {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} );
[1 2 3,
4 5 6,
7 8 9]
To construct matrices from expressions, use Matrix(). Elements must be expressions that resolve to numbers.
A = Matrix( {4 * 5, 8 ^ 2, Sqrt( 9 )} );
[20, 64, 3]