How to create a simple matrix from two different kind of matrix size ?
1 view (last 30 days)
Show older comments
I have a matrix whose size is 2X5X2 double and another matrix whose size is 2X5 double how i can create a matrix from it where there will be two rows and 15 column total ?
0 Comments
Accepted Answer
Bruno Luong
on 10 Jul 2022
M1 = rand(2,5,2) ;
M2 = rand(2,5) ;
reshape(cat(3,M1,M2),size(M1,1),[])
0 Comments
More Answers (2)
Abderrahim. B
on 10 Jul 2022
Hi !
Try this:
M1 = rand(2,5,2) ;
M2 = rand(2,5) ;
M = [M1(:,:,1) M1(:,:,2) M2] ;
size(M)
Maybe there is a better way to do this.
HTH
See Also
Categories
Find more on Logical 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!