How to combine two arrays

6 visualizaciones (últimos 30 días)
MIch
MIch el 30 de Sept. de 2022
Comentada: MIch el 30 de Sept. de 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]?

Respuesta aceptada

Robert U
Robert U el 30 de Sept. de 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

Más respuestas (1)

zhehao.nkd
zhehao.nkd el 30 de Sept. de 2022
Try reshape([a;b],1,[])

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by