index exceeds the number of array elements error
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!