How a fill an array with the same value

200 ビュー (過去 30 日間)
Federico Ferrara
Federico Ferrara 2020 年 8 月 17 日
コメント済み: Star Strider 2020 年 8 月 17 日
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

採用された回答

Star Strider
Star Strider 2020 年 8 月 17 日
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 件のコメント
Federico Ferrara
Federico Ferrara 2020 年 8 月 17 日
Yes, it works, thanks.
Star Strider
Star Strider 2020 年 8 月 17 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by