How to combine two arrays?

1,196 views (last 30 days)
SUSHMA MB
SUSHMA MB on 6 Mar 2017
Answered: Opeyemi Kehinde on 17 Dec 2021
I have two arrays
x = 561x1 double
y = 561x1 double
How can i combine it into
z = 561x2 double
  1 Comment
Talha Azmat
Talha Azmat on 7 Jan 2020
use combine function

Sign in to comment.

Accepted Answer

KSSV
KSSV on 6 Mar 2017
x = rand(561,1) ;
y = rand(561,1) ;
z = [x y]

More Answers (1)

Opeyemi Kehinde
Opeyemi Kehinde on 17 Dec 2021
This will combine everything vertically
ba=rand(5,1);
bc=rand(5,1);
bd=cat(1,ba,bc)
bd = 10×1
0.4521 0.3754 0.6376 0.0726 0.5931 0.1914 0.1244 0.5883 0.7074 0.7833
and this will combine them horizontally
ba=rand(5,1);
bc=rand(5,1);
bd=cat(2,ba,bc)
bd = 5×2
0.7514 0.2128 0.2607 0.8915 0.1605 0.1310 0.7830 0.8906 0.2156 0.7069

Community Treasure Hunt

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

Start Hunting!