function initprefs
%INITPREFS Runs all PREFSPANEL functions.
%   INITPREFS scans the MATLAB path for all files called prefspanel.m and
%   evaluates each in turn.  Each prefspanel.m file registers the preferences
%   panel for a given toolbox.
%
%   See also PREFSPANEL

%   Copyright 1984-2000 The MathWorks, Inc.
%   $Revision: 1.3 $  $Date: 2000/06/01 16:19:27 $

all_prefspanels = which('-all','prefspanel.m');
for i = 1:length(all_prefspanels)
    fid  = fopen(all_prefspanels{i}, 'r');
    if fid ~= -1
        file = setstr(fread(fid)');
        fclose(fid);
        idx = findstr(file, 'prefspanel');
        if ~isempty(idx)
        	file(1:(idx(1)+10)) = [];
        end
        try
            eval(file)
        catch
            defwarn = warning;
            warning('on')
            warning(['Could not evaluate ''' all_prefspanels{i} ...
                    '''. Error Message: ' lasterr]);
            warning(defwarn)
        end
    end
end
