# I have 4 arrays of 335 elements each, i want one array(resultant) whcih consists of first array element in first element and first array element of second array into second element of resultant array and first array element of third array into third

4 views (last 30 days)
Mohammed Yousuf on 2 Dec 2016
Commented: bio lim on 2 Dec 2016
eg: a=[1;2;3] b=[4;5;6] c=[7;8;9]
and i want d=[1;4;7;2;5;8;3;6;9]
please help me out,
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Answers (2)

bio lim on 2 Dec 2016
Edited: bio lim on 2 Dec 2016
Like this?
a=[1;2;3];
b=[4;5;6];
c=[7;8;9];
d = [a';b';c'];
d = reshape(d, [9 1]);
Output:
d =
1
4
7
2
5
8
3
6
9
##### 6 CommentsShow 4 older commentsHide 4 older comments
KSSV on 2 Dec 2016
Check the answer....below.
bio lim on 2 Dec 2016
It's still the same approach.
a=rand(335,1);
b=rand(335,1);
c=rand(335,1);
d=rand(335,1);
e=[a';b';c';d'];
e = reshape(e, [1340 1]);

Sign in to comment.

KSSV on 2 Dec 2016
clc; clear all ;
a=[1;2;3] ;
b=[4;5;6] ;
c=[7;8;9] ;
abc = [a b c]' ;
iwant = abc(:)
##### 1 CommentShow -1 older commentsHide -1 older comments
KSSV on 2 Dec 2016
x=rand(335,1) ;
y=rand(335,1) ;
z=rand(335,1) ;
w=rand(335,1) ;
xyzw = [x y z w]' ;
iwant = xyzw(:) ;

Sign in to comment.

### Categories

Find more on Data Preprocessing 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!