Hello
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
B=[];
for i=0:352
B_temp=A(1+(36*i):36+(36*i));
B=[B; B_temp];
end

 采纳的回答

Ameer Hamza
Ameer Hamza 2020-12-30
编辑:Ameer Hamza 2020-12-30
Directly use reshape()
B = reshape(A, [36 353]).'

2 个评论

It works. Thanks for the quick and valuable response !!!!
I am glad to be of help!

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by