필터 지우기
필터 지우기

3d matrix to 2d matrix

조회 수: 1 (최근 30일)
anto
anto 2023년 1월 8일
댓글: anto 2023년 1월 8일
I have this matrix
val(:,:,1) =
0.5000 0
0.5000 0.3333
0.5000 0.6667
0.5000 1.0000
val(:,:,2) =
0.5000 0
0.1667 0.3333
0.5000 0.6667
0.5000 1.0000
val(:,:,3) =
0.5000 0
0.8333 0.3333
0 0.6667
0 0
I want to convert it from the 3D matrix 4x2x3 to a 12x2 matrix but that it is sorted as it was at the start.
So the output is this:
0.5000 0
0.5000 0.3333
0.5000 0.6667
0.5000 1.0000
0.5000 0
0.1667 0.3333
0.5000 0.6667
0.5000 1.0000
0.5000 0
0.8333 0.3333
0 0.6667
0 0
I think i have to use the reshape with permute function but i didnt quite get the correct syntax to ordinate properly the output.
Any help would be greatly appreciated.

채택된 답변

Matt J
Matt J 2023년 1월 8일
편집: Matt J 2023년 1월 8일
I think i have to use the reshape with permute function but i didnt quite get the correct syntax to ordinate properly the output.
The bulk of the work is done for you in this FEX download,
output = blkColon(val,[4,2])
  댓글 수: 1
anto
anto 2023년 1월 8일
Thanks a lot, have a good day

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by