How to append elements in a vector one by one

2 visualizaciones (últimos 30 días)
ck poon
ck poon el 21 de Mzo. de 2019
Comentada: madhan ravi el 21 de Mzo. de 2019
I'm given two vector and i'm supposed to append the elements of the second matrix to the first matrix one by one, i can do this together but i cant seem to do it one by one, am i supposed to use a for loop somewhere?
%define vector A
A = [1 2 4] ;
%define vector B
B = [5 6 7] ;
%append B to A
A = [A,B]

Respuestas (1)

madhan ravi
madhan ravi el 21 de Mzo. de 2019
No loop is needed: Vertically concatenate the two vectors and use reshape.
  1 comentario
madhan ravi
madhan ravi el 21 de Mzo. de 2019
Try the suggested answer if it doesn’t do what you want , upload what you have tried.

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by