How do I create a (10,10) matrix containing numbers from 1 to 100?
413 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tom
el 18 de Sept. de 2013
Comentada: finess
el 28 de Ag. de 2022
How do I create a (10,10) matrix containing numbers from 1 to 100?
I just want the numbers to go 1 to 10 on the top row, then 11-20 on the 2nd row etc.
2 comentarios
Respuesta aceptada
Más respuestas (4)
Steven Lord
el 25 de En. de 2022
Another solution using implicit expansion (which wasn't available back in 2013 when this question was posted):
n = 10;
A = (1:n) + n*(0:n-1).'
0 comentarios
SYED ABOU ILTAF HUSSAIN
el 2 de Sept. de 2018
Editada: SYED ABOU ILTAF HUSSAIN
el 2 de Sept. de 2018
Try this a= [1:10]; for i=2:10 a(i,:)=a(i-1,:)+10; end
0 comentarios
finess
el 26 de Ag. de 2022
create a new 4x4 matrix that is filled with the number 100
8 comentarios
Walter Roberson
el 27 de Ag. de 2022
Editada: Walter Roberson
el 27 de Ag. de 2022
There are a number of different ways to achieve the same result.
A = 100 + zeros(4,4)
A = 100 * ones(4,4)
A = 100; A = A(ones(4,4))
A = zeros(4,4); A(:) = 100
A(1:4,1:4) = 100
A = repmat(100,4,4)
finess
el 28 de Ag. de 2022
Wow I love these Answers! It gives me a feeling of how a great teacher looks like, with great options for students
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!