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.

 Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 28 Avr 2016

0 votes

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

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by