How to reshape a vector in a particular way

14 views (last 30 days)
I got a column vector
a = [a1 a2 a3 ... an-1 an]'
and I wanna rearrange that in the following matrix
b = [a1 a2;a3 a4; ...; an-1 an]
like the first two pairs are the rows of the matrix, any tips on how achieve this?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 20 Mar 2013
Edited: Azzi Abdelmalek on 20 Mar 2013
b=reshape(a,2,[])'

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!