Vectors and Matrix

There are two ways to create vectors and matrices in MatDeck.

The first one: place cursor in the canvas and use the Insert Matrix option from Math tab.

Insert Matrix

The second one: use a vector or matrix function that will create a 2×1 vector or a 2×2 matrix.

Insert matrix function

To create a new column right from the current cursor position column, use the Space key on your keyboard. Remember that for this action, the node where the cursor is placed has to be empty.

Create new column

To create a new row under the current cursor position row, use the Enter key on your keyboard. For this action also, node where the cursor is placed has to be empty.

Create new row

To delete the current cursor position column, use Ctrl + Space keys. Node where the cursor is placed has to be empty.

Delete current column

To delete the current cursor position row, press Ctrl + Enter. Again, make sure that the node where the cursor is placed is empty.

Delete current row

Now we are going to explore functions for vector and matrix manipulations. Create three vectors and two matrix and place them in variables. To join them one beside another , use function join matrix columns.

Join matrix columns function

To join them one above the other use function join matrix rows.

Join matrix rows function

To extract one column from vector or matrix use the function column2vector. Second argument is the position of column (zero indexed).

Extract one column

To extract one row from vector or matrix, use the function row2vector. Second argument is the position of the row (zero indexed).

Extract one row

To assign a specific value to a specific position of vector or a matrix, use function set value at.

Set a specific value

Third argument of set value at function is the position of row and the fourth argument is the position of column of inserted matrix.

To create a matrix from two column vectors use function vec2mat column.

Create matrix from columns

To create a matrix from two row vectors use the function called vec2mat rows.

Create matrix from rows

Last function that we are going to use in this lesson is subset. With the subset function, you can extract a part of a vector of matrix.

Subset function