question about command 'mat2cell'
Mostra commenti meno recenti
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 !
Risposta accettata
Più risposte (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 Commento
qing li
il 30 Lug 2022
Categorie
Scopri di più su Image Arithmetic in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!