Replacing array with a subset of another array
이전 댓글 표시
I have two arrays, A and B.
A=[1;2;3;4];
B=[0;0;0;0;0;0];
I want the replace A into B with the remaining zeros staying. So the output would be:
C=[1;2;3;4;0;0]
How can I do this?
답변 (1개)
Star Strider
2018년 4월 28일
One approach:
A=[1;2;3;4];
B=[0;0;0;0;0;0];
C = B;
C(1:numel(A)) = A;
카테고리
도움말 센터 및 File Exchange에서 Library Development에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!