Placing data in a matrix

1 view (last 30 days)
stelios loizidis
stelios loizidis on 30 Dec 2020
Commented: Ameer Hamza on 30 Dec 2020
I have the following problem: I have a matrix A (12708X1). I want to put the data of matrix A in a matrix B which has size 353X36. In other words, every 36 rows of matrix A become columns for matrix B. I wrote a code but the result is that the resulting matrix B has size 12708X1. How is this problem solved? Your help is important. This is the code I wrote:
% matrix A size:12708X1
for i=0:352
B=[B; B_temp];

Accepted Answer

Ameer Hamza
Ameer Hamza on 30 Dec 2020
Edited: Ameer Hamza on 30 Dec 2020
Directly use reshape()
B = reshape(A, [36 353]).'
Ameer Hamza
Ameer Hamza on 30 Dec 2020
I am glad to be of help!

Sign in to comment.

More Answers (0)


Find more on Resizing and Reshaping 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!