matrix creation with same values (say 1:1200) in each column (1200x1200 matrix)

3 visualizaciones (últimos 30 días)
Hello, I want to create a matrix of 1200x1200. I want to have a values of 1:1200 in sequence in each column and there will be a total of 1200 columns. Columns will be identical but the numbers will vary regularly in the column. Say i want the matrix similar to this but with 1200 columns and rows. 1 1 1 ... 1 2 2 2 ... 2 3 3 3 ... 3 . . . ... . . . . ... . . . . ... . 1200 1200 1200 ... 1200 Please help me. thanks a lot in advance. asim

Respuesta aceptada

Martin
Martin el 2 de Oct. de 2011
Try repmat((1:1200).',1,1200)

Más respuestas (1)

Zahra Arj
Zahra Arj el 2 de Oct. de 2011
for i=1:1200 for j=1:1200 x(i,j)=i; end end
but it takes a lot of time...
  1 comentario
Asim Biswas
Asim Biswas el 2 de Oct. de 2011
thank you so much. it worked this way too. yes, this is the matrix I wanted.
thanks again.
asim

Iniciar sesión para comentar.

Categorías

Más información sobre Logical 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