= chi2gof(x) performs a chi-square goodness-of-fit test of the default null hypothesis that the data in vector x are a random sample from a normal distribution with mean and variance estimated from x, against the alternative that the data are not normally distributed with the estimated mean and variance. The result h is 1 if the null hypothesis can be rejected at the 5% significance level. The result h is 0 if the null hypothesis cannot be rejected at the 5% significance level.
The null distribution can be changed from a normal distribution to an arbitrary discrete or continuous distribution. See the syntax for specifying optional argument name/value pairs below.
The test is performed by grouping the data into bins, calculating the observed and expected counts for those bins, and computing the chi-square test statistic