Matrix (or multiple-dimensional array)
Matrices (sometimes called 2D or multidimensional arrays) are containers for many values. For example, a tic-tac-toe board is a 2D matrix of 3 rows and 3 columns, each holding a character (usually 'x,' 'o,' and ' '). Matrices have all the same properties as arrays and are indexed in the same manner, just using multiple "indexes," one for each row, column, etc.
Matrix
For general information on arrays, see Arrays.
Matrices are often 2D arrays. They can be 3D, 4D, or N-D, where N is any positive number.
Matrices are used wherever it is appropriate to put information in tables where the information can be "indexed" by both a row and a column (in 2D).
In Matlab, matrices are indexed from 1 (just like arrays). In C, Java, and ActionScript, matrices are indexed from 0.
Matrices are almost always associated with nested loops. Nested loops represent placing one loop inside of another. In the case of a 2D matrix, we would have an outer loop (for i = 1 to the number of rows) and an inner loop (for j = 1 to the number of columns).
Here is a sample (in Matlab) of creating a "multiplication table." The matrix represents the multiplication charts. Each "bucket" in the matrix holds the row times the column.
In Matlab, we access a matrix by using () and commas between the row, column, etc. For example, multiplication_chart(5,10) = 50;
In C, Java, and ActionScript, we access a matrix by using one set of []s per dimension. For example, multiplication_chart[4][9] = 50; Notice how in these languages, we index from 0!