Clear Filters
Clear Filters

stack multidimensional matrices horizontally

7 views (last 30 days)
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,

Accepted Answer

Birdman
Birdman on 8 Feb 2018
One approach
A=randi([1 5],3,3,30,10);%demo data
permute(reshape(A,3,30,30),[1 2 3])
  3 Comments
Birdman
Birdman on 9 Feb 2018
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!