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.
Details
- 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.
- MatrixQ[expr,NumberQ] tests whether expr is a numerical matrix.
Examples
open allclose allBasic Examples (3)
Scope (2)
Applications (1)
Properties & Relations (3)
MatrixQ is a special case of ArrayQ:
A matrix is made up of vectors of equal length:
MatrixQ effectively uses AllowedHeads"ListLike":
Text
Wolfram Research (1988), MatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixQ.html (updated 2003).
CMS
Wolfram Language. 1988. "MatrixQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/MatrixQ.html.
APA
Wolfram Language. (1988). MatrixQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MatrixQ.html