function buttonloadPGA(hObject, eventdata, Empty_Button, Buttons, AxesD, AxesSVD, AxesSOL, AxesAOM, DataText, Recondition, RegSlider, RegText, titles, usmn, usmf, SVDText, rbplotsvd)
data = get(Empty_Button,'UserData');
step=data.step;

timeSVD = data.timeSVD;
timeFAC = data.timeFAC;
if isfield(data,'PathName') == 1
    PathName = data.PathName;
end

tmppeakhint = data.peakhint;

data = [];

data.step = step;
data.isdata = 0;
data.isbd = 0;
data.isamp = 0;
data.issvd = 0;
data.isnovctrs = 0;
data.isautodetect = 0;
data.autodetect = [];
data.isreg = 0;
data.issol = 0;
data.isSOL = 0;
data.noc = 0;
data.SOL = [];
data.isautosol = 0;
data.iscon = 0;
data.isgivenspec = 0;
data.givenspec = [];
data.givenadaptedis = 0;
data.givenadaptedI = [];

data.timeSVD = timeSVD;
data.timeFAC = timeFAC;

data.weights.dfault = [100 10 10 500 1 .5];
data.weights.start = [10 0.25 .1 0 0 0];
data.weights.max = data.weights.dfault;

fname = mfilename;
calcp = mfilename('fullpath');
calcp = calcp(1:end-length(fname));
filename =calcp + "prefs/prefs.mat";

if exist(filename,'file') == 2
    load(filename,'prefs');
else
    prefs = [1 0.0025 30 0 0 0];
end

data.prefs = prefs;

set(titles(6),'String','filename');

set(DataText(4), 'String', '');
set(DataText(6), 'String', '');

if exist('PathName') == 1
    data.PathName = PathName;
end

data.isred = 0;
data.islive = 0;
data.livet = [];
data.peakhint = tmppeakhint;

set(usmn,'Value',0);
set(usmf,'Value',1);
SliderOnOffPGA(RegSlider, RegText, data, 0);

set(DataText(1),'String','');

set(Recondition(2),'String','missing','ForegroundColor','r');
set(Recondition(4),'String','missing','ForegroundColor','r');
set(RegText(44),'String','')
set(RegText(45),'String','')
set(RegText(46),'String','')
set(RegText(47),'String','')
set(RegText(48),'String','')
set(RegText(49),'String','')
set(SVDText(1),'BackgroundColor',0.94*[1 1 1]);
set(SVDText(1),'Value',[]);
set(SVDText(2),'BackgroundColor',0.94*[1 1 1]);
set(SVDText(3),'String','Used singular            vectors: ')
set(SVDText(1),'String','')
set(Buttons(4),'BackgroundColor',0.94*[1 1 1]);
set(Buttons(6),'BackgroundColor',0.94*[1 1 1]);
set(Buttons(17),'BackgroundColor',0.94*[1 1 1]);

plot(AxesD,1,0,'w');
plot(AxesSVD,1,0,'w');
plot(AxesSOL,1,0,'w');
plot(AxesAOM(1),1,0,'w');   set(AxesAOM(1), 'XTick', [], 'YTick', []);
plot(AxesAOM(2),1,0,'w');   set(AxesAOM(2), 'XTick', [], 'YTick', []);
plot(AxesAOM(3),1,0,'w');   set(AxesAOM(3), 'XTick', [], 'YTick', []);

onoffButton(Buttons,[],[2 4:15 17 19 21]);

if get(RegSlider(8), 'Value') > 0
    set(Recondition(10), 'String', 'missing','ForegroundColor','r');
else
    set(Recondition(10), 'String', 'nonrelevant','ForegroundColor','k');
end

if ispc
    dlm = '\';
else
    dlm = '/';
end

if isfield(data,'PathName') == 0
    actpwd = pwd;
    if strcmp(actpwd(end-9:end), 'subfcnsPGA') == 1
        data.PathName = actpwd(1:end-10);
    else
        data.PathName = [pwd, dlm];
    end
end

actpwd = pwd;
cd(data.PathName);
[FileName,PathName,FilterIndex] = uigetfile('*.mat','Select .mat file including the data Matrix D');
cd(actpwd);

if FilterIndex == 0
    set(hObject,'UserData',data);
    set(DataText(1),'String',sprintf('Warning:\nData-loading process canceled.'),'ForegroundColor','red');
    set(Empty_Button,'UserData',data);
    return
end

data.FileName = FileName;
data.PathName = PathName;

load([PathName FileName]);
if ~exist('D','var') || length(size(D)) ~= 2
    set(DataText(1),'String',sprintf(['Warning:\nNo matrix D in file\n"',FileName,'"']),'ForegroundColor','red');
    data.D = [];
    data.x = [];
    set(Empty_Button,'UserData',data);
    return
else
    k = size(D,1);
    n = size(D,2);
    if min(k,n) < 2
        set(DataText(1),'String',sprintf(['Warning:\nMatrix D of bad dimension: ', num2str(k), ' x ', num2str(n)]),'ForegroundColor','red');
        data.D = [];
        data.x = [];
        set(Empty_Button,'UserData',data);
        return
    end
    
    if min(min(isfinite(D))) == 0
        set(DataText(1),'String',sprintf('Warning:\nMatrix D has at least one nonreal entry.'),'ForegroundColor','red');
        data.D = [];
        data.x = [];
        set(Empty_Button,'UserData',data);
        return
    end
    
    if ~exist('x','var') && exist('X','var')
        x = X;
    end
    
    if ~exist('t','var') && exist('T','var')
        t = T;
    end

    set(hObject, 'Enable','off');
    set(gcf,'Pointer','Watch');
    pause(0.5);
    
    if exist('x','var')
        if min(size(x)) == 1
            if size(x,1) < size(x,2)
                x = x';
            end
            
            if size(x,1) ~= n
                if size(x,1) == k
                    D = D';
                    k = size(D,1);
                    n = size(D,2);
                else
                    x = (0:n-1)';
                end
            end
        else
            x = (0:n-1)';
        end
    else
        x = (0:n-1)';
    end
    
    if exist('t','var')
        if min(size(t)) == 1
            if size(t,1) < size(t,2)
                t = t';
            end
            
            if size(t,1) ~= k
                t = (0:k-1)';
            end
        else
            t = (0:k-1)';
        end
    else
        t = (0:k-1)';
    end
    
    data.x = x;
    data.time = t;
    data.D = D;
    
    if data.x(1) > data.x(2)
        data.x = data.x(end:-1:1);
        data.D = data.D(:,end:-1:1);
    end
    
    id = preprocPGA(data.D,data.prefs(2),data.prefs(3),data.prefs(4));
    data.id = id;

    plot(AxesD,data.x(id),data.D(:,id)','k');
    axis(AxesD,'tight');
    yl = get(AxesD,'ylim');
    yl = [min(0,yl(1)), yl(2)*1.1];
    set(AxesD,'ylim',yl);
    xlabel(AxesD,'channel');
    
    text(AxesD,0.5,0.7,data.peakhint,'Color',[1 0.7 0.6],'FontSize',18,'Units','normalized','HorizontalAlignment', 'center');
    hold(AxesD, 'off');
    
    data.yl = yl;
    
    [k, n] = size(data.D);
    data.SVDco = min([k, n, 30]);
    
    tim = cputime;
    
    [data.U0,data.S0,data.V0] = svds(data.D, data.SVDco);
    
    data.timeSVD = data.timeSVD+cputime-tim;
%     set(InfoText(11), 'String', [num2str(data.timeSVD, '%2.2f'), ' s']);
    
    for i=1:size(data.U0,2)
        if sum(max(data.V0(:,i),0).^2) < sum(min(data.V0(:,i),0).^2)
            data.U0(:,i) = -data.U0(:,i);
            data.V0(:,i) = -data.V0(:,i);
        end
    end

    set(gcf,'Pointer','arrow');
    set(hObject, 'Enable','on');
    
    onoffButton(Buttons,[2 11 18],[4:10 12:15 19 21]);
    set(Buttons(4),'BackgroundColor',0.94*[1 1 1]);
    set(Buttons(6),'BackgroundColor',0.94*[1 1 1]);
    set(Buttons(17),'BackgroundColor',0.94*[1 1 1]);
    set(titles(6),'String',['file: ', [PathName, FileName]]);
%     set(titles(6),'String',['file: FT_IR/',FileName])
    
%     set(titles(6),'String','file: path/FileName');
%     set(titles(6),'String','file: C:/dataset_1');
%     Titelnichtrichtig = 1
    
    set(DataText(4), 'String', num2str(size(data.D,1)));
    set(DataText(6), 'String', num2str(size(data.D,2)));

    set(DataText(9), 'String', []);
    set(DataText(8), 'String', []);
    
    set(Recondition(2),'String','done','ForegroundColor','k');
    
    data.isdata = 1;
    set(hObject,'BackgroundColor',0.94*[1 1 1]);

%     data.isnovctrs = 1;
%     data.novctrs = round(str2double(get(SVDText(7),'String')));


    set(Empty_Button,'UserData',data);
    
    buttonsvdPGA(hObject, eventdata, Empty_Button, Buttons, AxesSVD, SVDText, rbplotsvd, RegSlider, RegText, usmn, usmf);
    plot(AxesSVD,1,0,'w');
end
