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

Elements Of A Vector
 Syntax vector` ( `index` )` See Also elements , base , sequential subvectors , and matrix elements

Description
References the element with the specified index in the specified vector, where index is an integer scalar. (If index is real, or double-precision, it is interpreted as an integer using the same convention as in the int function. )

Tutorial
The indices of a vector are numbered from 1 to `n`, where `n` is the number of elements in the vector. The expression `x(2)` accesses the second element of the vector `x`. If you enter ```      x = [3, 5, 7]      x(2) ``` O-Matrix will respond ```      5 ``` You can also use this notation to assign an element of an existing vector. The result has the type that corresponding to coercion between the type of the original matrix and the type of the element. ```      x = [1, 2, 3]      x(2) = 4.4      print type(x), x ``` results in ```      real [ 1 , 4.4 , 3 ] ```