Add multiple elements to array
95 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sferle Alin-Tudor
am 30 Mai 2021
Kommentiert: David Horton
am 23 Dez. 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 Kommentare
Akzeptierte Antwort
KALYAN ACHARJYA
am 30 Mai 2021
Bearbeitet: KALYAN ACHARJYA
am 30 Mai 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 Kommentare
KALYAN ACHARJYA
am 30 Mai 2021
Bearbeitet: KALYAN ACHARJYA
am 30 Mai 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
Still not see repelem
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!