How can I concatenate these two arrays in this manner?

6 vues (au cours des 30 derniers jours)
Sad Satan
Sad Satan le 21 Août 2020
Commenté : Fangjun Jiang le 21 Août 2020
Lets say I have the following two arrays:
A = [0.707, -0.707]; B = [0, 2];
and I want to concatenate them such that the result is:
C = [0.707, 0 , -0.707 , 2];
I have tried every trick but no luck so far. Any ideas? While there is probably a way to concatenate the two manually, I want a process that works on any matrices of different lengths, etc.

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 21 Août 2020
C=[A;B];
C=C(:)';
  2 commentaires
Sad Satan
Sad Satan le 21 Août 2020
Thank you. What does "C(:)'" do? Is there a name for this specific command?
Fangjun Jiang
Fangjun Jiang le 21 Août 2020
Type "doc :" in Command Window

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating 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