Add multiple elements to array

52 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2021-5-30
编辑:KALYAN ACHARJYA 2021-5-30
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 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2021-5-30
编辑:KALYAN ACHARJYA 2021-5-30
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by