assuming k = 4 and ind is an matrix of 4x6(4 rows x 6 columns ) -->ind(:,k) will give u all elements of column 4(value of k) in a single row matrix
assuming you are making a matrix H H(ind(:,k), ind(:,k)) --> that value in 4th column of ind matrix will decide which element will be update in H with the value in S
assuming 1st ind(:,k) = [1 2] 2nd ind(:,k) = [3 4]
then assignments will be like
H(1,3)=S H(1,4)=S H(2,3)=S H(2,4)=S