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 CenterFile Exchange에서 State-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