For the latest version of JMP Help, visit JMP.com/help.


Scripting Guide > Data Structures > Matrices in JSL Scripts > Inquiry Functions in Matrices
Publication date: 04/21/2023

Inquiry Functions in Matrices

The NCol() and NRow() functions return the number of columns and rows in a matrix (or data table), respectively:

NCol( [1 2 3, 4 5 6] ); // returns 3 (for 3 columns)
NRow( [1 2 3, 4 5 6] ); // returns 2 (for 2 rows)

To determine whether a value is a matrix, use the Is Matrix() function, which returns a 1 if the argument evaluates to a matrix.

A = [20, 64, 3];
B = {20, 64, 3};
Is Matrix( A ); // returns 1 for yes
Is Matrix( B ); // returns 0 for no
Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).