No need for cell arrays, which use braces. Use just regular double arrays with parentheses:
num(k) = sum(histgrm(:) == 0);
I think it's also deceptive to name a binary image "histgrm" which leads the reader to think it's a histogram instead of a binary image outputted from im2bw().
Next you need to initialize s to 1 instead of zero because there is no zeroth element in MATLAB.