Efficient way to divide array into tiles
4 ビュー (過去 30 日間)
古いコメントを表示
I use the following code to divide array into tiles
n=2;nrow=3;ncol=3;
A=reshape(1:36,6,6)
A=mat2cell(A,zeros(nrow,1)+n,zeros(ncol,1)+n);
A=reshape(A,1,[]);
A=cellfun(@(x) x(:),A,"UniformOutput",false);
A=cell2mat(A)
Now each column contains the element of each 2-by-2 tile.
The problem is when A is large and n is small the use of cell array creates significant overhead. Is there a more efficient way to do this?
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!