필터 지우기
필터 지우기

Reshaping a a matrix

조회 수: 2 (최근 30일)
Dam
Dam 2014년 1월 10일
댓글: Dam 2014년 1월 10일
Good evening, I have the following question pleas suppose I hava a matrix: [1 2 3 4 5 6 ; 7 8 9 10 11 12] (2*6) i want to reshape it to get the following matrix [1 2 7 8; 3 4 9 10 ; 5 6 11 12](3*4) Thank you in advance

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 10일
편집: Azzi Abdelmalek 2014년 1월 10일
a=[1 2 3 4 5 6 ; 7 8 9 10 11 12]
[n,m]=size(a);
b=reshape(a',m,1,[]);
c=permute(reshape(b,2,[],size(b,3)),[2 1 3]);
out=c(:,:)
%or
a=[1 2 3 4 5 6 1 0; 7 8 9 10 11 12 44 55] ;
b=permute(reshape(a',2,size(a,2)/2,[]),[2 1 3]);
out=b(:,:)
  댓글 수: 1
Dam
Dam 2014년 1월 10일
Thank you so much :)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Risk Management Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by