Is there a function to make a long list of a single value?
1 回表示 (過去 30 日間)
古いコメントを表示
I.e. if I want to make a list 400 values long of all 1's, I would use
ones(400,1)
But what if I wanted to make a list of say, 5's?
Is there a function I can use to do this without using a for loop?
0 件のコメント
採用された回答
Star Strider
2022 年 5 月 24 日
Try this —
Fives = 5*ones(400,1)
.
2 件のコメント
Star Strider
2022 年 5 月 24 日
Thank you!
I’m certain you would have in a few minutes. (I’ve been doing this for a while.)
Another option —
Fives = 5+zeros(400,1)
.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!