Further Structural OperationsThis section discusses some further structural operations that are useful for working with matrices. This generates a sample matrix for demonstration. In[1]:=  |
Out[2]//MatrixForm=
|
This flattens the matrix into a vector. In[3]:=  |
Out[4]=
|
The vector can be partitioned back into a matrix with rows of length 3 using Partition. In[5]:=  |
Out[5]=
|
Matrices can be joined together with the function Join. In[6]:=  |
Out[6]//MatrixForm=
|
A new row can be inserted at the end of a matrix with Append. In[7]:=  |
Out[7]//MatrixForm=
|
It should be noted that this can also be done with Insert. This is shown in the section Inserting Rows and Columns.
|