필터 지우기
필터 지우기

how to generate matrix of size 10X10?

조회 수: 43 (최근 30일)
asram eluru
asram eluru 2014년 3월 26일
댓글: Walter Roberson 2023년 2월 21일
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
Chandrasekhar
Chandrasekhar 2014년 3월 26일
ones(10,10) will generate a 10x10 matrix

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

답변 (2개)

Andrei Bobrov
Andrei Bobrov 2014년 3월 26일
one way
ones(10,1)*(1:10)
  댓글 수: 2
Ankita Kalra
Ankita Kalra 2017년 10월 16일
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 2017년 10월 16일
Transpose the result of the above. Or use (1:10).' * ones(1,10)

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


Julie
Julie 2023년 2월 21일
편집: Julie 2023년 2월 21일
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
Walter Roberson
Walter Roberson 2023년 2월 21일
The user needed a specific matrix in which all of the columns were the same

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

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by