How to replace values in a matrix with another set of values
2 次查看(过去 30 天)
显示 更早的评论
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!
2 个评论
Jan
2018-10-18
Do you mean the values 59688:60003, or are these the indices of the values you want to replace?
采纳的回答
Image Analyst
2018-10-18
Try this
% Stuff sourceVector into indexes 59688:60003 of targetVector
targetVector(59688:60003) = sourceVector;
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!