MATLAB: How to replace values in a matrix with another set of values

arrayImage Processing Toolboxmatrixreplace

Hi,
I have a 91282 x 1 matrix and I want to replace the specific values 59688:60003 (n=315) with another set of 315 numbers (a 315 x 1 matrix) in those exact places. What is the best way of doing this? Thanks!

Best Answer

Try this
% Stuff sourceVector into indexes 59688:60003 of targetVector
targetVector(59688:60003) = sourceVector;