In MATLAB, you can take the second column of a matrix by using the colon operator :
to select all rows of the matrix and the index 2
to select the second column.
main.m62 chars3 lines
The output of second_column
will be:
main.m6 chars4 lines
In the code above, the :
operator specifies that we want to select all rows of the matrix, and the 2
specifies that we want to select the second column. The resulting vector second_column
is a column vector containing only the elements of the second column of matrix
.
gistlibby LogSnag