rk_x23
rk_x23

Reputation: 45

Arrange elements of array into one column

I have a 500x2 array with some data in Matlab

X1 X2
X3 X4
X5 X6
.....

I want to arrange it in an array with one column

 X1
 X2
 X3
 X4
 ..

Can someone give me some tips as to how it can be done?

Thanks!

Upvotes: 2

Views: 51

Answers (1)

Dan
Dan

Reputation: 45752

Assuming your array is called X:

Xt = X';            %'// Use X.' if you're dealing with complex numbers
Xcol = Xt(:)

Or else you could do

Xcol = reshape(X', [], 1)

Upvotes: 4

Related Questions