index exceeds the number of array elements error
Afficher commentaires plus anciens
This is my code while i type a as 254 and manually divide it by 32 and use floor(254/32)+1 i get 8 however in the code i gets 9. I dont understand how this can happen, it an esay math computation, could anybody explain it to me?
K=256; %
B=32; % binSize 32 I values are 1 bin;
Hist=zeros(1,2^(log2(K)-log2(B)))
[w, h] =size(I);
for v=1:1:h
for u=1:1:w
a=I(u,v,1);
i=floor(a/B)+1;
Hist(i)=Hist(i)+1
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing 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!