convert column vectors to 2D array

37 views (last 30 days)
John on 2 Oct 2012
If you had two column vectors (2 columns of data) in the workspace, how could you convert this to a 2D array?
Thanks for your help

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 2 Oct 2012
Edited: Azzi Abdelmalek on 2 Oct 2012
v=[a'; b'] % vertical concatenation
w=[a b ] % horizontal concatenation

Wayne King
Wayne King on 2 Oct 2012
Also, you can use cat()
x = randn(100,1);
y = randn(100,1);
z = cat(2,x,y);


Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!