Vector to rows and columns

조회 수: 4 (최근 30일)
Snicklefrits
Snicklefrits 2021년 11월 9일
댓글: Snicklefrits 2021년 11월 9일
I have a vertical vector say 1:100
and I want to shape it into a 10 by 10 matrix but instead of up 123.. going down in the first column I want to go across left to right ie
12345
678910.
I tried reshape already but that didnt work.
Thanks

채택된 답변

Image Analyst
Image Analyst 2021년 11월 9일
Try this:
T = [ 0
0
0
0
443.8427
538.0802
943.8368
0
699.2106
764.6411
949.4726
0
823.7174
871.8012
949.7888
0
852.0567
949.0575
949.9969
0
686.3944
946.7604
0
0
0
0
0
0];
TReshaped = reshape(T(:), 4, [])'
TReshaped = 7×4
0 0 0 0 443.8427 538.0802 943.8368 0 699.2106 764.6411 949.4726 0 823.7174 871.8012 949.7888 0 852.0567 949.0575 949.9969 0 686.3944 946.7604 0 0 0 0 0 0
  댓글 수: 3
Image Analyst
Image Analyst 2021년 11월 9일
I don't know what that means. I left off the semicolon so it spits out the matrix value to the command window. Please explain in more detail
  1. what "list" means to you, and
  2. what "automatically" means to you.
Snicklefrits
Snicklefrits 2021년 11월 9일
My apologies I thought you retyped my array out by hand and that was the soltuion. Your answer worked perfectly. Thank you.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by