Matlab: assign to matrix with column\row index pairs [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How can I change the values of multiple points in a matrix? I have a matrix A and three vectors of the same length, r , holding the indexes of the rows to assign to, c , holding the indexes of the columns to assign to, and v containing the actual values to assign. What I want to get is A(r(i),c(i))==v(i) for all i . But doing A(r,c)=v; Doesn't yield the correct result as matlab interprets it as choosing every