Contents Previous Next Subchapters Current Chapters-> vectorelem matrixelem rowcol seqrowcol seqsubvec subblock nonseq vecind endexp base colbase rowbase Parent Chapters-> Omatrix6 submatrices matrixelem Search Tools-> contents reference index search

Elements Of A Matrix
 Syntax matrix` (`row index`, `column index`)` See Also base , elements , and vector elements

Description
References the element with the specified row and column index in the specified matrix, where row index and column index are integer scalars. (If either of the indices is real, or double-precision, it is interpreted as an integer using the same convention as in the int function. )

Tutorial
The row indices of a matrix are numbered from 1 to `m`, where `m` is the number of rows in the matrix. Similarly, the column indices of a matrix are numbered from 1 to `n`, where `n` is the number of columns in the matrix. The expression `x(2, 3)` accesses the element in the second row and third column of the matrix `x`. If you enter ```      x = {[1, 2, 3, 4], [5, 6, 7, 8]}      x(2, 3) ``` O-Matrix will respond ```      7 ``` You can also use this notation to assign an element of an existing matrix. The result has the type that corresponds to coercion between the type of the element and the original matrix. ```      x(1, 4) = 23d0      print type(x), x ``` results in ```      double {      [ 1 , 2 , 3 , 23 ]      [ 5 , 6 , 7 , 8 ]      } ```