Add -Inf as the first element of the edges vector and/or Inf as the last element.
>> x = randn(1, 1e6);
>> h = histogram(x, [-Inf -2:0.25:2 Inf]);
>> tooSmallH = h.Values(1)
>> tooSmallX = nnz(x < -2)
>> tooLargeH = h.Values(end)
>> tooLargeX = nnz(x > 2)
The two variables whose names start with tooSmall should have the same value, as should the two variables whose names start with tooLarge.
Best Answer