How to combine two arrays

3 vues (au cours des 30 derniers jours)
MIch
MIch le 30 Sep 2022
Commenté : MIch le 30 Sep 2022
Hello,
for example there are a= [3 5 1] and b = [4 6 7]
How can I combine a and b to get c= [3 4 5 6 1 7]?

Réponse acceptée

Robert U
Robert U le 30 Sep 2022
Hi MIch,
have a look in the documentation under language fundamentals --> reshape()
a = [3 5 1];
b = [4 6 7];
c= reshape([a' b']',1,[])
c = 1×6
3 4 5 6 1 7
Kind regars,
Robert
  1 commentaire
MIch
MIch le 30 Sep 2022
Thank you very much

Connectez-vous pour commenter.

Plus de réponses (1)

zhehao.nkd
zhehao.nkd le 30 Sep 2022
Try reshape([a;b],1,[])
  1 commentaire
MIch
MIch le 30 Sep 2022
Thank you very much

Connectez-vous pour commenter.

Catégories

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by