Matrix Fill with same number sequence

3 次查看(过去 30 天)
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

请先登录,再进行评论。

更多回答(1 个)

Atsushi Ueno
Atsushi Ueno 2021-4-20
repelem(20:30,6,1)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by