I have 2 arrays A = [ 1 2 3 4 5] B = [ 0 0 3] How do can i get C = [ 1 2 3 4 5;0 0 3 0 0] in a general way because im running loop with B changing each loop? A size remain the same. Size B<A.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 28일

0 개 추천

A = [ 1 2 3 4 5]
B = [ 0 0 3]
C=[A;B zeros(1,numel(A)-numel(B))]

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2016년 4월 28일

댓글:

2016년 4월 29일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by