Matrix Fill with same number sequence

2 visualizaciones (últimos 30 días)
TheDice
TheDice el 20 de Abr. de 2021
Comentada: Walter Roberson el 20 de Abr. de 2021
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 20 de Abr. de 2021
YourMatrix(1:6,1:2:end) = 20;
YourMatrix(1:6,2:2:end) = 30;
  2 comentarios
TheDice
TheDice el 20 de Abr. de 2021
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 el 20 de Abr. de 2021
YourMatrix(1,1:5) = 20;
YourMatrix(2,:) = 30;

Iniciar sesión para comentar.

Más respuestas (1)

Atsushi Ueno
Atsushi Ueno el 20 de Abr. de 2021
repelem(20:30,6,1)

Categorías

Más información sobre State-Space Control Design and Estimation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by