Goodness of fit (cdf: empirical vs theoretical)? I have a data-set with n = 90, probably follows the gamma distribution (and others). I used the maximum-likelihood estimation (MLE) to estimated the alpha and beta parameters of the gamma distribution using Matlab.

What is the best way to test the fit (goodness of fit) of the gamma distribution with the estimated parameters versus the original data-set ?
Can I compare the cumulative distribution function (cdf) - empirical vs theoretical ?
empirical_cdf   = ecdf ( data set )
theoretical_cdf = cdf ( gammafit ) 
And make same test, for example the KS two samples
kstest2 ( empirical_cdf, theoretical_cdf )
Is this the correct way ?
Many thanks

The histogram in the last question is only a example of 1 data-set (1 of 10000). 
I'll rephrase my question, I have a total of 10000 data-sets, and I wonder if the Gamma distribution is better (in terms of goodness-of-fit) that Weibull distribution for example.
or
For a data-set of 10000 what percentage fit better to gamma, and what percentage fit better to Weibull distribution ?
As you can see my data-set is big, and impossible to check one-by-one. 
What is the best way to do the goodness-of-fit to found this percentages ?
Many thanks
 A: I don't use matlab, but how about we check the documentation of the function. It says:

kstest2  
Kolmogorov-Smirnov test to compare the distribution of two samples

So no, that's not used for comparing a fitted distribution to a sample.
What about kstest? Well, if we check the documentation there, the answer is still no:

The Kolmogorov-Smirnov test requires that cdf be predetermined. It is not accurate if cdf is estimated from the data.

That pretty much covers it. There's a Lilliefors test (matlab has a function for the normal case, mentioned in the documentation for kstest). You could do something similar to that by simulating the distribution of the test statistic. 
But often people test goodness of fit in situations in which it's not really useful to do so. (This may be the case here as well - why are you testing goodness of fit?)
A: Thank you for the clarification. This answer refers not to your original question, but to reformulated one. I would consider using a benchmarking package/library. I don't work with Matlab, so cannot suggest anything for that platform. However, if you can use R, I recommend you to take a look at the benchmark package: http://cran.r-project.org/web/packages/benchmark. Since you don't need to perform sampling (as your 10000 data sets are samples, if I understand correctly), you'd need to specify goodness-of-fit tests as algorithms in benchmark's terminology and run benchmarking across all data sets and all selected potential distributions (Gamma, Weibull, etc.). You could also use parametric distribution fitting packages/libraries prior to benchmarking to find the optimal parameters for the distributions. At least, this is the direction, which I would have explored first.
