Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

convert column vectors to 2D array

Asked by John

John (view profile)

on 2 Oct 2012

Hello,

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

0 Comments

John

John (view profile)

Products

No products are associated with this question.

2 Answers

Answer by Azzi Abdelmalek

Azzi Abdelmalek (view profile)

on 2 Oct 2012
Edited by Azzi Abdelmalek

Azzi Abdelmalek (view profile)

on 2 Oct 2012
a=[1;2;3]
b=[11;12;13]
v=[a'; b']  % vertical concatenation
w=[a b ]    % horizontal concatenation

0 Comments

Azzi Abdelmalek

Azzi Abdelmalek (view profile)

Answer by Wayne King

Wayne King (view profile)

on 2 Oct 2012

Also, you can use cat()

x = randn(100,1);
y = randn(100,1);
z = cat(2,x,y);

0 Comments

Wayne King

Wayne King (view profile)

Contact us