Matrix Fill with same number sequence

2 ビュー (過去 30 日間)
TheDice
TheDice 2021 年 4 月 20 日
コメント済み: Walter Roberson 2021 年 4 月 20 日
How can I fill a matrix with the same sequence of numbers?
I want a matrix in which the first row contains 20 and 30. this should then also be in the next five rows.

採用された回答

Walter Roberson
Walter Roberson 2021 年 4 月 20 日
YourMatrix(1:6,1:2:end) = 20;
YourMatrix(1:6,2:2:end) = 30;
  2 件のコメント
TheDice
TheDice 2021 年 4 月 20 日
Thank you an how could i fill a matrix that it looks like this?
20 20 20 20 20
30 30 30 30 30
Walter Roberson
Walter Roberson 2021 年 4 月 20 日
YourMatrix(1,1:5) = 20;
YourMatrix(2,:) = 30;

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

その他の回答 (1 件)

Atsushi Ueno
Atsushi Ueno 2021 年 4 月 20 日
repelem(20:30,6,1)

カテゴリ

Help Center および File ExchangeState-Space Control Design and Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by