How to stack columns in a matrix?

10 views (last 30 days)
Rijul Chauhan
Rijul Chauhan on 31 Mar 2022
Answered: Voss on 31 Mar 2022
Hello all,
So I have a xyz coordinate matrix in the following format:
A = [x y z x y z x y z ...];
How do I convert it to look like:
B = [x y z;
x y z;
x y z;
...
...
...]
Thank you!

Answers (1)

Voss
Voss on 31 Mar 2022
A = 1:12
A = 1×12
1 2 3 4 5 6 7 8 9 10 11 12
B = reshape(A,3,[]).'
B = 4×3
1 2 3 4 5 6 7 8 9 10 11 12

Products

Community Treasure Hunt

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

Start Hunting!