Add multiple elements to array
23 ビュー (過去 30 日間)
古いコメントを表示
Sferle Alin-Tudor
2021 年 5 月 30 日
コメント済み: David Horton
2021 年 12 月 23 日
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 で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!