index exceeds the number of array elements error
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!