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

3 vues (au cours des 30 derniers jours)
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.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by