Split every matrix in cell and make it into different cell
2 次查看(过去 30 天)
显示 更早的评论
I have a cell which size is 20000x1 and it contains a 32x32x2 matrix in every cell, can i split the cell into two 20000x1 cell and each of them contains the 32x32x1 data?
0 个评论
采纳的回答
per isakson
2021-9-5
One way
%%
M = ones(32,32,2,3); % Sample data (20000 replaced by 3)
C = mat2cell( M, 32, 32, 2, ones(1,3) );
%%
C = squeeze( C )
%%
[C1,C2] = cellfun( @(m) deal(m(:,:,1),m(:,:,2)), C, 'uni',false )
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!