Clear Filters
Clear Filters

Transform a vector by keeping the numbers by pairs

1 view (last 30 days)
Let's say I have a vector that contains some coordinates (x,y) in this way:
A=[1 2 3 4 5 6 7 8 9 10]
And I want to transform it in this matrix:
A = [1 2
3 4
5 6
7 8
9 10]
How can I do it? 'reshape' command is not what I'm searching. Thanks for the help.

Accepted Answer

Walter Roberson
Walter Roberson on 18 May 2018
reshape(A, 2, []).'

More Answers (0)

Categories

Find more on Startup and Shutdown 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!