How can I convert an array to a matrix?
    조회 수: 90 (최근 30일)
  
       이전 댓글 표시
    
I have an array like B=[2 3 1 5 2 8 1 7 9 1 5 2 4 6 3 9 3 1 7 0 7 2 8 6].
I need this elements in a matrix called A like
A=
2 3 1 5 2 8 1 7
9 1 5 2 4 6 3 9
3 1 7 0 7 2 8 6
Please help...
댓글 수: 0
채택된 답변
  José-Luis
      
 2013년 1월 29일
         B=[2 3 1 5 2 8 1 7 9 10 5 21 4 6 3 9 3 1 7 0 7 2 8 6];
 A = reshape(B,8,3)'
댓글 수: 0
추가 답변 (2개)
  Andreas Goser
    
 2013년 1월 29일
        In MATLAB all arrays are matrices... You may achieve what you need by using the RESHAPE command.
댓글 수: 0
  Martin
 2013년 1월 29일
        As Jose mentioned the reshape function is a really good one. The help file on that one is really useful for explaining how it works.
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



