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

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

 채택된 답변

Martin
Martin 2011년 10월 2일

0 개 추천

Try repmat((1:1200).',1,1200)

댓글 수: 1

Thank you so much. its great. this is exactly I wanted.
thanks again.
asim

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Zahra Arj
Zahra Arj 2011년 10월 2일

0 개 추천

for i=1:1200 for j=1:1200 x(i,j)=i; end end
but it takes a lot of time...

댓글 수: 1

thank you so much. it worked this way too. yes, this is the matrix I wanted.
thanks again.
asim

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Error Detection and Correction에 대해 자세히 알아보기

질문:

2011년 10월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by