reshape a column vector in a row-wise direction?

if I have column vector A= 1;2;3;4;5;6;7;8;9;10 how do I get matlab to reshape it in the row wise direction so it becomes
A= 1 2 3 4 5
6 7 8 9 10
as the reshape function seems to take it in column wise direction format?

 Accepted Answer

A= [1;2;3;4;5;6;7;8;9;10 ] ;
B = reshape(A,[],2)'

3 Comments

Better to use transpose .'
hey thanks for answering, if i want it reshaped with a certain row r column c, would it be reshape(A,[],r,c)'. I have to import data from a column vector into a certain r and c
oh got it now thanks

Sign in to comment.

More Answers (0)

Categories

Asked:

on 16 Aug 2018

Edited:

on 16 Aug 2018

Community Treasure Hunt

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

Start Hunting!