필터 지우기
필터 지우기

Defining a square matrix

조회 수: 15 (최근 30일)
Maroulator
Maroulator 2014년 12월 10일
답변: Star Strider 2014년 12월 10일
I have an array b=1:0.1:10.9 which I am trying to enter into a 10X10 square matrix. I have managed the following solution, however, I can see this having some issues should I choose to have a large array and square matrix. Is there a simpler way to accomplish what I do with the following code? Thanks in advance.
a=zeros(10,10); b=1:0.1:10.9;
for i=1:100 a(i)=b(i); end

채택된 답변

Star Strider
Star Strider 2014년 12월 10일
This works:
b=1:0.1:10.9;
B = reshape(b,10,10);
‘B’ is the matrix.

추가 답변 (0개)

카테고리

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