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.

 Accepted Answer

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

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!