MATLAB Answers

Reshaping array horizontally elementwise

400 views (last 30 days)
Hi,
I have a 1 x 100 array, A. How can I reshape it so that I have a 10 x 10 double so that the first ten elements are the first row, second ten element are the second row, etc.
I tried reshape(A, [10,10]) but that arranged them down columns instead of rows. Any help would be appreciated!
Sushma

  0 Comments

Sign in to comment.

Accepted Answer

sushma sharma
sushma sharma on 28 Sep 2016
got it!
reshape(A, 10 [])'

  0 Comments

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 28 Sep 2016
Try transposing the array first before reshaping:
M = reshape(M', 10, []);

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags