How a fill an array with the same value

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

 Respuesta aceptada

Star Strider
Star Strider el 17 de Ag. de 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 comentarios

Federico Ferrara
Federico Ferrara el 17 de Ag. de 2020
Yes, it works, thanks.
Star Strider
Star Strider el 17 de Ag. de 2020
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Operators and Elementary Operations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 17 de Ag. de 2020

Comentada:

el 17 de Ag. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by