help with matrix and how to extract rows
1 次查看(过去 30 天)
显示 更早的评论
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 :


0 个评论
采纳的回答
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 个评论
更多回答(2 个)
madhan ravi
2020-9-30
Wanted = mat2cell(matrix, repelem(6, numel(matrix)/36)) % not tested
celldisp(Wanted)
0 个评论
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)'
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!