How a fill an array with the same value
211 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Federico Ferrara
il 17 Ago 2020
Commentato: Star Strider
il 17 Ago 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
Risposta accettata
Star Strider
il 17 Ago 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Operators and Elementary Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!