How a fill an array with the same value
180 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Federico Ferrara
am 17 Aug. 2020
Kommentiert: Star Strider
am 17 Aug. 2020
I would like to fill an array of zeros with all 10s. So for instance,
N=4
V=zeros(N,1)
I want to have V= [10 10 10 10] without writing it manually, how can i do?
thanks
Akzeptierte Antwort
Star Strider
am 17 Aug. 2020
Try this:
N=4
V=zeros(N,1) + 10
Note that because of the way you wrote the zeros call, it will be a column vector, not the row vector you posted.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Operators and Elementary Operations 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!