Hi everyone
I have a trivial question but a bit tricky to put into code. I have 10 multidimensional matrices each of size 3 x 3 x 30. What I want to do is horizontally stack each of the smaller 3 x 3 matrices from all 10 matrices and form 1 big multidimensional matrix.. so the final size should be like 3 x 30 x 30.
How can i do this?
Thanks,

 채택된 답변

Birdman
Birdman 2018년 2월 8일

1 개 추천

One approach
A=randi([1 5],3,3,30,10);%demo data
permute(reshape(A,3,30,30),[1 2 3])

댓글 수: 3

androidguy
androidguy 2018년 2월 9일
편집: androidguy 2018년 2월 9일
Can you explain what the [1 2 3] is for in your code? Thank you for the elegant answer.
Birdman
Birdman 2018년 2월 9일
Normally reshape would vertically concentenate your matrices. Permute helps me to do ot horizontally and [1 2 3] stands for swapping the 1st and 3rd dimensions.
androidguy
androidguy 2018년 2월 9일
Got it. Thanks again.

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

제품

질문:

2018년 2월 8일

댓글:

2018년 2월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by