# hist2d!

hist2d!(counts, M, e1, e2) -> (e1, e2, counts)

Compute a "2d histogram" with respect to the bins delimited by the edges given in `e1` and `e2`. This function writes the results to a pre-allocated array `counts`.

## Examples

``````julia> counts = zeros(Int, 3, 3);
julia> M = [1.2, 2.5, 0.8, 1.7, 2.9];
julia> e1 = [0.0, 1.0, 2.0, 3.0];
julia> e2 = [0.0, 1.5, 3.0, 4.5];

julia> hist2d!(counts, M, e1, e2)
([0.0, 1.0, 2.0, 3.0], [0.0, 1.5, 3.0, 4.5], [0 1 0; 1 1 0; 0 0 0])

julia> counts
3×3 Array{Int64,2}:
0  1  0
1  1  0
0  0  0``````

This example demonstrates how to use `hist2d!` to compute a 2D histogram. The `counts` array is pre-allocated with zeros and has dimensions (3, 3). The `M` array contains the data points. The `e1` and `e2` arrays define the bin edges. The function computes the histogram and modifies the `counts` array in-place. The function returns a tuple containing the bin edges and the modified `counts` array.

Note: It is important to ensure that the dimensions of the `counts` array match the number of bins specified by the bin edges. Also, make sure that the data points in `M` fall within the range defined by the bin edges to obtain accurate results.