Creation of matrix (72,1) by defined elements

Hello. I have three matrices (24,1): Pstmax(24,1), Pproda(24,1), Pprodb(24,1), and i want to create a matrix ub(72,1) that contains the elements of the three defined matrices as follow:
Best regards.

 Accepted Answer

Stephen23
Stephen23 on 16 Jan 2016
Edited: Stephen23 on 16 Jan 2016
ub = reshape([Pstmax,Pproda,Pprodb].',[],1)
or if they could be row vectors:
ub = reshape([Pstmax(:),Pproda(:),Pprodb(:)].',[],1)

More Answers (1)

This works:
Pstmax = randi(99, 24, 1);
Preproda = randi(99, 24, 1);
Preprodb = randi(99, 24, 1);
Prevct = reshape(reshape([Pstmax; Preproda; Preprodb], [], 3)', [], 1);

Categories

Community Treasure Hunt

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

Start Hunting!