help with matrix and how to extract rows

조회 수: 2 (최근 30일)
Jama Ali
Jama Ali 2020년 9월 30일
댓글: Ameer Hamza 2020년 10월 1일
Hi, would like to manipulate this matrix to get 6x6 matrices.
i like to make the first 6 rows to be the new first row, then 7 to 12 to be the second row and then 13to 19 to be the third row and so one. how can i manipulate the, it should look like this :

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 9월 30일
편집: Ameer Hamza 2020년 9월 30일
You can use reshape()
reshape(Radiatondamping(1,:), 6, 6).'
the above will convert first column to 6x6 matrix. To convert all columns and combine them in 3D matrix
permute(reshape(Radiatondamping.', 6, 6, []), [2 1 3])
  댓글 수: 6
Jama Ali
Jama Ali 2020년 9월 30일
Thank you for your help. It made my school project much easier.
Ameer Hamza
Ameer Hamza 2020년 10월 1일
I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

madhan ravi
madhan ravi 2020년 9월 30일
Wanted = mat2cell(matrix, repelem(6, numel(matrix)/36)) % not tested
celldisp(Wanted)

Image Analyst
Image Analyst 2020년 9월 30일
편집: Image Analyst 2020년 9월 30일
Here's one way (tested on made up "data"):
data = randi(99, 12, 6)
[rows, columns] = size(data)
newRows = rows / 6 % This better be an integer!!!
d = data'
Radiatondamping = reshape(d(:), [], newRows)'

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by