Returns a specified row from a matrix.
a (NxK matrix) – data
row (scalar) – The row of the matrix to extract
y (1xK row vector) – extracted data
First create a matrix, a:
a = rndn(10, 10);
Now you can assign a variable y to be equal the third row of a with either of the following statements.
y = getRow(a, 3);
y = a[3, .];
While both statements will produce the same result, the first may make for code that is easier to read and interpret.
getRow() is designed to give an alternative access to rows in a matrix
than indexing the matrix by brackets.