Efficient way to divide array into tiles
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Get Started with MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!