function editusingvctrsPGA(hObject, eventdata, Empty_Button, Buttons, RegSlider, Recondition, SVDText, rbplotsvd, AxesSVD)
data = get(Empty_Button,'UserData');
data.isnovctrs = 0;

% if (isfield(data,'isdata')*isfield(data,'issvd') == 1) && (data.isdata*data.issvd == 1) && (~isempty(get(hObject,'String')))
%     data.novctrs = getsetvar(hObject, 1, data.SVDco, 1, 2);

if (isfield(data,'isdata')*isfield(data,'issvd') == 1) && (data.isdata*data.issvd == 1) && (~isempty(get(hObject,'Value')))
    data.novctrs = get(hObject,'Value');
    set(Recondition(8), 'String','done','ForegroundColor','k');
    
    if (isfield(data,'isbd')*isfield(data,'issvd') == 1) && (data.isbd*data.issvd == 1)
        if get(RegSlider(8), 'Value') > 0
            if (isfield(data,'isgivenspec') == 1) && (data.isgivenspec == 1)
                onoffButton(Buttons,4,[]);
                set(Buttons(4),'BackgroundColor',[0.8500 0.3250 0.0980]);
            end
        else
            onoffButton(Buttons,4,[]);
            set(Buttons(4),'BackgroundColor',[0.8500 0.3250 0.0980]);
        end
    end
    if (isfield(data,'issvd')*isfield(data,'isautodetect') == 1) && (data.issvd*data.isautodetect == 1)
        if get(RegSlider(8), 'Value') > 0
            if (isfield(data,'isgivenspec') == 1) && (data.isgivenspec == 1)
                onoffButton(Buttons,17,[]);
                set(Buttons(17),'BackgroundColor',[0.8500 0.3250 0.0980]);
            end
        else
            onoffButton(Buttons,17,[]);
            set(Buttons(17),'BackgroundColor',[0.8500 0.3250 0.0980]);
        end
    end
    set(hObject,'BackgroundColor','w');
    set(SVDText(2),'BackgroundColor',0.94*[1 1 1]);
    data.isnovctrs = 1;
%     set(SVDText(2),'String','Singular values: '+string(get(hObject,'Value')))
    set(SVDText(3),'String','Used singular            vectors: '+string(get(hObject,'Value')))
else
    set(Recondition(8), 'String','missing','ForegroundColor','r');
%     set(hObject, 'String', '');
    onoffButton(Buttons,[],[4 17]);
    set(Buttons(4),'BackgroundColor',0.94*[1 1 1]);
    set(Buttons(17),'BackgroundColor',0.94*[1 1 1]);
end
onoffButton(Buttons,[21],[]);
set(Empty_Button,'UserData',data);

if (isfield(data,'isdata')*(isfield(data,'issvd')) == 1) && (data.isdata*data.issvd == 1) && ~isempty(rbplotsvd)
    
    i1 = 1;
    i2 = get(hObject, 'Value');
    
    if get(rbplotsvd(1), 'Value') == 1
        plot(AxesSVD, data.time, data.U(:,i1:i2), 'Linewidth',2);
        axis(AxesSVD,'tight');
        xlabel(AxesSVD,'time');
    elseif get(rbplotsvd(2), 'Value') == 1
        semilogy(AxesSVD, i1:i2, diag(data.S(i1:i2, i1:i2)),' k-.o', 'Linewidth',2);
        axis(AxesSVD,'tight');
        yl = get(AxesSVD, 'Ylim');
        set(AxesSVD, 'Xlim', [i1-.1, i2+.1], 'Ylim', [0.9, 1.1].*yl);
        xlabel(AxesSVD,'index');
    else
        plot(AxesSVD, data.x, data.V(:,i1:i2), 'Linewidth',2);
        axis(AxesSVD,'tight');
        xlabel(AxesSVD,'channel');
    end
end
