필터 지우기
필터 지우기

Using vertcat on multidimensional array data

조회 수: 2 (최근 30일)
Elizabeth
Elizabeth 2012년 12월 19일
I need to create a new array from a 55x365x100 multidimensional array. Each 55x365 matrix (indexed by numbers 1:100) needs to be concatenated, so the resulting array should be 5500x365.
It appears that the vertcat function would accomplish this, but I really don't want to write out each index like so: vertcat(n(:,:,1),n(:,:,2),...,n(:,:,100))
Is there a way to make a list of all such matrices, n(:,:,k), that is usable in vertcat function?
I'm fairly new to MATLAB and still trying to familiarize myself with the syntax.

채택된 답변

Jonathan Sullivan
Jonathan Sullivan 2012년 12월 19일
x = rand(55,365,100);
x_new = reshape(permute(x,[ 1 3 2 ]),5500,[]);
  댓글 수: 1
Elizabeth
Elizabeth 2012년 12월 19일
Thank you very much! Worked exactly how I needed it to. Happy Holidays to you!

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

추가 답변 (2개)

Matt J
Matt J 2012년 12월 19일
A=num2cell(n,[1,2]);
vertcat(A{:});

Matt J
Matt J 2012년 12월 19일
A=permute(n,[1,3,2]);
reshape(A,[],365);

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by