フィルターのクリア

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

2 ビュー (過去 30 日間)
Yildirim Kocoglu
Yildirim Kocoglu 2018 年 2 月 2 日
コメント済み: Greg 2018 年 2 月 2 日
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 Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by