How to append vectors end to end???

129 visualizzazioni (ultimi 30 giorni)
Ihtisham Khan
Ihtisham Khan il 3 Mag 2018
Commentato: Ihtisham Khan il 3 Mag 2018
Hi, I have two vectors and wanted to join these vectors end to end. The output i wanted is,
[c]=
1 2 3 4 5 6 7 8 9 10 11 12 13 14
but when i run the code,
e.g.
[a] = [1 2 3 4 5 6 7] ;
[b] = [8 9 10 11 12 13 14];
[c] = [a ; b];
output::
[c] =
1 2 3 4 5 6 7
8 9 10 11 12 13 14
How would I do this? Thanks for your help.
  3 Commenti
Stephen23
Stephen23 il 3 Mag 2018
Basic MATLAB concepts, such as how to create and concatenate arrays, are covered in the introductory tutorials (which are highly recommended for all beginners):
Ihtisham Khan
Ihtisham Khan il 3 Mag 2018
thanks Stephen Cobeldick and Dennis

Accedi per commentare.

Risposta accettata

Ameer Hamza
Ameer Hamza il 3 Mag 2018
See cat().
out = cat(2, a, b);
cat gives you better flexibility over how to concatenate.

Più risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by