How do I add 1 arrays elements into another array

2 vues (au cours des 30 derniers jours)
Tyler Jacobson
Tyler Jacobson le 22 Sep 2017
Commenté : Jan le 22 Sep 2017
I would like to amend 1 matrix into another matrix of the same size that would double the array in length. For instance I have a 1 x 1001 matrix that I would like to add to another matrix of 1 x 1001 to make 1 1 x 2002 matrix

Réponses (1)

Adam
Adam le 22 Sep 2017
  1 commentaire
Jan
Jan le 22 Sep 2017
Or with the comma explicitly:
a = [b, c]
This avoid some troubles in the case of using numerical scalars and operators, see:
[2-3], [2 -3], [2 - 3], [2, -3]
But in your case it is unequivocal.
Alternative:
cat(2, b, c)
or
horzcat(b, c)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by