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


Scripting Guide > Data Structures > Matrices > Comparisons, Range Checks, and Logical Operators
Publication date: 04/30/2021

Comparisons, Range Checks, and Logical Operators

JMP’s comparison, range check, and logical operators work with matrices and produce matrices of elementwise Boolean results. You can compare conformable matrices.

A < B; // less than
A <= B; // less or equal
A > B; // greater than
A >= B; // greater or equal
A == B; // equal to
A != B; // not equal to
A < B < C; // continued comparison (range check)
A | B; // logical OR
A & B; // logical AND
( A & !B ) | ( !A & B ); // exlusive OR
!( A & B ) & ( A | B ); // exlusive OR

You can use the Any() or All() functions to summarize matrix comparison results. Any() returns a 1 if any element is nonzero. All() returns a 1 if all elements are nonzero.

[2 2] == [1 2]; // returns [0 1], therefore:
All( [2 2] == [1 2] ); // returns 0
Any( [2 2] == [1 2] ); // returns 1

Min() or Max() return the minimum or maximum element from the matrix or matrices given as arguments.

A = [1 2 3, 4 5 6, 7 8 9, 10 11 12];
B = [0 1 2, 2 1 0, 0 1 1, 2 0 0];
Min( A ); // returns 1
Max( A ); // returns 12
Min( A, B ); // returns 0
Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).