Pick out and extract parts of matrices.

Create a matrix

Use Table to set up a 5×5 matrix:

Use MatrixForm to format the output as a regular array:

  • Matrices in the Wolfram Language are not restricted to number entries.

Extract a single part

Use Part to pick the second element of the first row:

  • Part has the short form notation [[... ]].

Extract a row

To take an entire row, use one index to specify the row:

Extract a column

To take an entire column, select all the rows and specify the column:

Extract a submatrix

Use Span to specify the relevant rows and columns that make up a submatrix:

Extract all elements except the outermost rows and columns using negative indices:

  • Negative indices count from the end of a list.