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))]

1 件のコメント

Lam Nguyen
Lam Nguyen 2016 年 4 月 29 日
Thank you for your answer

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by