Matrix manipulation-changing number of rows & columns of a matrix & keeping all of the elements
조회 수: 3 (최근 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 Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!