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

Antworten (2)

bio lim
bio lim am 2 Dez. 2016
Bearbeitet: bio lim am 2 Dez. 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 Kommentare

for 3X3 matrix it works, i said i have 335 elements in my array., 3 element array was an example.., anthing using for loop is appreciable.., please. urgent
Don't say urgent: You said you have 4 arrays of 335 element. Clarify your self.
sorry, sir it is, 4 column vectors each carry 335 elements, eg: x=(335,1) y=(335,1) z=(335,1) w=(335,1), among this i need a column 'a' vector whcih consist of first element of x, as a first element of 'a', then first element of 'y' as a second element of 'a', then first element of 'z' as a third element of 'a',and first element of 'w' as a fourth element of 'a' then repeat as so on
second element of 'a' must be second element of x,y,z,w as so on
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]);

Melden Sie sich an, um zu kommentieren.

clc; clear all ;
a=[1;2;3] ;
b=[4;5;6] ;
c=[7;8;9] ;
abc = [a b c]' ;
iwant = abc(:)

Kategorien

Gefragt:

am 2 Dez. 2016

Kommentiert:

am 2 Dez. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by