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에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!