Add multiple elements to array
98 次查看(过去 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
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
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
Still not see repelem
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!