To subset the first column of a matrix in MATLAB, you can use the colon operator :
main.m162 chars8 lines
In the above code example, we create a 3x3 matrix called myMatrix
and then select the first column of the matrix using the :
operator to select all rows and the column index 1
. The resulting output will be a column vector containing the values [1;4;7]
.
gistlibby LogSnag