This error will occur when "month" is not numeric, since "hist" function expects a numeric argument. To resolve this error, you need to use a numeric data type as an argument of "hist" function.
You may also explore "histogram" function as an alternative. Please find the link for the documentation of "histogram": https://www.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.histogram.html
I hope this helps!