Gistlib Logo

gistlib

index second column of matrix c in matlab

You can index the second column of matrix C in MATLAB using the following code:

main.m
C(:, 2)
8 chars
2 lines

This would give you all the rows in the second column of matrix C. In MATLAB, the colon : is used to index all elements along a certain dimension, and 2 specifies the second column.

similar matlab code snippets

display last column in matrix in matlab
how to add multiple matrices in matlab
how to change the diagonal of a matrix 3x3 with a vector with 3 elements in matlab
how to change the diagonal of a matrix to be the sum of its position on row and column in matlab
replace last row of a matrix in matlab
the function mat2coord should take an n × n array representing a matrix a ∈ r n×n and return the sparse coordinate representation encoded by the three arrays, d, ridx, and cidx in matlab
how to call on a specific value in matlab
remove item from array in matlab
display last column in matrix with fprintf in matlab
find the coordinates of the largest value in a matrix in matlab

related categories

matrices
indexing
matlab

gistlibby LogSnag