Matrix manipulation-changing number of rows & columns of a matrix & keeping all of the elements

2 次查看(过去 30 天)
Hi, I'm trying to change this simple matrix below:
A(3,4)=[1,2,3,4;5,6,7,8;9,10,11,12]
to look like
A(6,2)=[1,2;3,4;5,6;7,8;9,10;11,12]
All the elements in A(3,4) exist in the new matrix A(6,2).
You can find the new row number (6) of the new matrix by using the formula below (the new matrix A(6,2) is 2 columns & stays that way):
[R,C]=size(A);
R_new=(((C/2)-1)*R)+R;
This is not the real data but, the code for the simplified version will help a lot.
I have already tried to write a code for it using "for loop" but, it didn't work.
Any help is appreciated.
Thank you.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by