Contents Previous Next Subchapters Current Chapters-> mlmode_assignment multiplestatement mlmode_same mlmode_if mlmode_for mlmode_while mlmode_colon mlmode_numbers mlmode_building mlmode_character mlmode_quote mlmode_matrixdivision mlmode_logicalop mlmode_numericop mlmode_realpart mlmode_matrixindex mlmode_logicalindex mlmode_grow Parent Chapters-> Omatrix6 mlmode mlmode_language mlmode_grow Search Tools-> contents reference index search

Automatic Growing of Matrices on Assignment (Mlmode)
 Syntax x`(`index`) = `expression x`(`row`, `column`) = `expression O-Matrix Mode indices

Description
If you assign to an index that does not exist, the matrix will grow to be just large enough to include the new index. The undefined entries in the larger matrix are initialized to zero.

Example

One Index
If in Mlmode you enter ```      x = [ 1 2 ];      x(4) = 4 ``` O-Matrix will reply ```      x = [ 1 , 2 , 0 , 4 ] ```
Two Indices
If enter ```      x = [ 1 2 0 4 ];      x(2, 2) = 4 ``` O-Matrix will reply ```      {      [ 1 , 2 , 0 , 4 ]      [ 0 , 4 , 0 , 0 ]      } ```
By Rows
If in Mlmode you enter ```      x      = 1;      x(3,:) = 3 ``` O-Matrix will reply ```      {      1      0      3      } ```
By Columns
If in Mlmode you enter ```      x      = 1;      x(:,3) = 3 ``` O-Matrix will reply ```      [ 1 , 0 , 3 ] ```