Flatten Any Mulitdimensional Matrix into a 2-D Matrix!

버전 1.0.0.0 (3.02 KB) 작성자: Darin Koblick
Convert any multidimensional matrix into a 2-D Matrix. Then convert it back to its original form.
다운로드 수: 329
업데이트 날짜: 2012/7/23

라이선스 보기

Take any N-D matrix in MATLAB and flatten it down into an N x size(ND,dim) 2-D matrix using fDim.m. This is often times necessary when writing complex operations on multidimensional matrices.

It is also desired that after flattening, the dimension that is preserved has the correct sequence. This is especially important for vector processing.

Once flattened, and an operation has been performed on the 2-D matrix, often times the 2-D matrix will need to be converted back to the original multidimensional matrix. This can be performed using eDim.m.

See the multiDimDemo.m for test cases using various matrix sizes and dimensions.

Example:
Given a multidimensional vector:
>> vector_1 = rand(3,3,3,4,5,3);

Flatten it into a 2-D matrix preserving the 3rd dimension which corresponds to the proper xyz order:
>> [vector_1_f, fSeq] = fDim(vector_1,3);

Convert the flattened matrix back to it's original multidimensional form still preserving the proper xyz order:
>> vector_1_e = eDim(vector_1_f,fSeq);

인용 양식

Darin Koblick (2024). Flatten Any Mulitdimensional Matrix into a 2-D Matrix! (https://www.mathworks.com/matlabcentral/fileexchange/37589-flatten-any-mulitdimensional-matrix-into-a-2-d-matrix), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Elementary Math에 대해 자세히 알아보기
도움

줌: KeplerMinMax

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0