Add multiple elements to array

103 visualizaciones (últimos 30 días)
Sferle Alin-Tudor
Sferle Alin-Tudor el 30 de Mayo de 2021
Comentada: David Horton el 23 de Dic. de 2021
Hi,
Is there possible to add more than one element to an array at the same time?Like in this array:
x=[];
x=[x,3];%and I want to add a number of 100 3 in x
  5 comentarios
Sferle Alin-Tudor
Sferle Alin-Tudor el 21 de Sept. de 2021
Thanks you @Torsten
David Horton
David Horton el 23 de Dic. de 2021
Thanks!!!!!!

Iniciar sesión para comentar.

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 30 de Mayo de 2021
Editada: KALYAN ACHARJYA el 30 de Mayo de 2021
Yes it's OK, horizontal concatenation
x=[x,3]
Example:
>> x=1:4
x =
1 2 3 4
>> x=[x,9:12]
x =
1 2 3 4 9 10 11 12
  3 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 30 de Mayo de 2021
Editada: KALYAN ACHARJYA el 30 de Mayo de 2021
See the repmat (Copiese array n times horizantly)
x= repmat(x , [1,n]) ;
e.g.
x =
1 2 3
>> x=repmat(x,[1,3])
x =
1 2 3 1 2 3 1 2 3
If this is not looking for then, please see the @Torsten comment
Still not see repelem
Sferle Alin-Tudor
Sferle Alin-Tudor el 21 de Sept. de 2021
Thank you very much

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by