question about command 'mat2cell'
Afficher commentaires plus anciens
dear all, I have an problem in terms of mat2cell command...
What i already know is how to deal with specific numbers, say for instance, the code for dividing image I (size 128*128 ) into non-overlapping blocks (size 8*8) is as the following:
c = mat2cell( I, [8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8], ...
[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]);
But I really struggled with how to write the code when there is no specific numbers, for example, divide an image I (size 128*128) into non-overlapping blocks (size n*n) , and the total amount of blocks is 128*128/n*n...
Could anyone help..? thx a lot !
Réponse acceptée
Plus de réponses (1)
Use repmat to build your vector of tile heights or widths.
A = ones(8);
n = 2;
v = repmat(n, 1, 4) % You could compute the 4 for this line
C = mat2cell(A, v, v)
1 commentaire
qing li
le 30 Juil 2022
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!