Borrar filtros
Borrar filtros

how to generate matrix of size 10X10?

43 visualizaciones (últimos 30 días)
asram eluru
asram eluru el 26 de Mzo. de 2014
Comentada: Walter Roberson el 21 de Feb. de 2023
I have generated the numbers from 1 to 10 by using the command 1:1:10. I got 1X10 size matrix but I want the matrix of size 10X10 i.e, each column values should be same. Please help me.
  1 comentario
Chandrasekhar
Chandrasekhar el 26 de Mzo. de 2014
ones(10,10) will generate a 10x10 matrix

Iniciar sesión para comentar.

Respuestas (2)

Andrei Bobrov
Andrei Bobrov el 26 de Mzo. de 2014
one way
ones(10,1)*(1:10)
  2 comentarios
Ankita Kalra
Ankita Kalra el 16 de Oct. de 2017
Dera Andrei, I need 1 to 10 values in a column of a 10x10 matrix (without the use of for loop).
Walter Roberson
Walter Roberson el 16 de Oct. de 2017
Transpose the result of the above. Or use (1:10).' * ones(1,10)

Iniciar sesión para comentar.


Julie
Julie el 21 de Feb. de 2023
Editada: Julie el 21 de Feb. de 2023
there is a simple and easy way by typing magic(x) on the command window
x means how many rows and columns in a matrix do you want, for example, if you want to build a 10x10 matrix, you just need to type magic(10) on the command window, then you will get what you want.
  1 comentario
Walter Roberson
Walter Roberson el 21 de Feb. de 2023
The user needed a specific matrix in which all of the columns were the same

Iniciar sesión para comentar.

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by