Mathematica > Core Language > Expressions > Testing Expressions >
Mathematica > Core Language > Procedural Programming > Conditionals > Testing Expressions >

MatrixQ

MatrixQ[expr]
gives True if expr is a list of lists or a two-dimensional SparseArray object that can represent a matrix, and gives False otherwise.
MatrixQ[expr, test]
gives True only if test yields True when applied to each of the matrix elements in expr.
  • MatrixQ[expr] gives True only if expr is a list, and each of its elements is a list of the same length, containing no elements that are themselves lists, or if expr is a two-dimensional SparseArray object.
New in 1 | Last modified in 5
© 2008 Wolfram Research, Inc.
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team