Fill S_matrix (index)