MATLAB: How to use a custom distribution with FITDIST in the Statistics Toolbox 7.1 (R2009a)

Statistics and Machine Learning Toolbox

I want to use a custom distribution with FITDIST. The issue I'm facing is that the custom distribution is not found. It will be recognized after adding the custom distribution to the DFITTOOL and using FITDIST afterwards, but not without doing so.
I want to do this automatically. So either adding custom distribution to the DFITTOOL without opening the GUI or FITDIST should be able to handle custom distributions as well.

Best Answer

The ability to do use a custom distribution with FITDIST directly is not available in Statistics Toolbox.
To work around this issue, you have to open DFITTOOL and add the custom distribution and execute afterwards FITDIST.
Another workaround is to create a function "dfittooldists.m" saved on the MATLAB path where you add a custom distribution (example see attached file). It is important to clear all known distributions from the root handle before using the following command as of R2009b:
setappdata(0,'Distribution_Fitting_alldistributions',[])
In MATLAB 7.8 (R2009a), the property is set in a slightly different manner as follows:
set(handle(0),'Distribution Fitting alldistributions',[])