Populate a column vector with values from another column vector
显示 更早的评论
Hey!
I have a column vector A that is 1x50 that contains values
I want to populate a 1x57 zero column vector B with the values of A at a certain index.
E.g. At index 0,1,2,5,7,8,11 should all be 0 - the other values of vector B should be populated from the non-zero values in vector A. How do i go about doing this?
2 个评论
KSSV
2022-12-5
How index can be 0? Index cannot be zero. Your question is not clear though.
Raahim Muzaffar
2022-12-5
采纳的回答
更多回答(1 个)
Voss
2022-12-5
B = zeros(57,1); % 57x1 column vector
B([4 5 7 10 11 13:end]) = A;
类别
在 帮助中心 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!