function changeWeights(hObject, eventdata, Empty_Button, Buttons, RegSlider, RegText, Recondition, weight, AxesSOL, AxesAOM, calcp)
data = get(Empty_Button,'UserData');

switch weight
    case 1
        dfault = [10 0.25 .1 0 0 0];
    case 2
        dfault = [5 0.5 .15 0 0 0];
    case 3
        dfault = [10 0.25 .1 2.5 0 0];
    otherwise
        % dfault = [10 0.25 .1 0 0 0];
        fname = mfilename;
        calcf = mfilename('fullpath');
        calcf = calcf(1:end-length(fname));
        filename =calcf + "weights/weights" + string(weight) +".mat";
%         isfile(filename)
        if exist(filename,'file') == 2
            load(filename,'dfault')
        else
            dfault = [10 0.25 .1 0 0 0];
        end
end

for i =1:6
    set(RegSlider(3+i),'Value',dfault(i))
    set(RegText(i+23), 'String', num2str(dfault(i)));
end

on = [];
off = [4 17];

if isfield(data,'isautodetect') == 1 && data.isautodetect == 1
    on = 17;
    off = 4;
elseif isfield(data,'isbd') == 1 && data.isbd == 1
    on = 4;
    off = 17;
% else
%     return
end

set(Buttons(off),'BackgroundColor',0.94*[1 1 1]);

% if (isfield(data,'issvd')*isfield(data,'isnovctrs') == 1) && (data.issvd*data.isnovctrs == 1)
if get(RegSlider(8), 'Value') > 0
    if (isfield(data,'isgivenspec') == 1) && (data.isgivenspec == 1)
        onoffButton(Buttons,on,[off]);
        set(Buttons(on),'BackgroundColor',[0.8500 0.3250 0.0980]);
        set(Recondition(10), 'String', 'online','ForegroundColor','k');
    else
        onoffButton(Buttons,[],[on off]);
        set(Buttons(on),'BackgroundColor',0.94*[1 1 1]);
        set(Recondition(10), 'String', 'missing','ForegroundColor','r');
    end
else
    onoffButton(Buttons,on,[off]);
    set(Buttons(on),'BackgroundColor',[0.8500 0.3250 0.0980]);
    set(Recondition(10), 'String', 'nonrelevant','ForegroundColor','k');
end

if (isfield(data,'islive') == 1) && (data.islive == 1)
    liveviewPGA(hObject, eventdata, Empty_Button, Buttons, RegText, RegSlider, AxesSOL, AxesAOM, calcp);
    set(Buttons(on),'Backgroundcolor',0.94*[1 1 1]);
end

% elseif (isfield(data,'islive') == 1) && (data.islive == 1)
%     liveviewPGA(hObject, eventdata, Empty_Button, Buttons, RegText, RegSlider, AxesSOL, AxesAOM, calcp);
% end