Problem:
Access the elements of a Matrix
Solution:
We can use the square brackets ( [] ) to select one or multiple elements from a matrix, similar to Vectors.Whereas vectors have one dimension and matrices have two dimensions. We need to use a comma to separate the row value selection and column value selection.
The code is as below:
To select all the elements of a row or a column, no number is needed before or after the comma, respectively:
You may also like the below topics:
Thank You for reading!
0