function buttonloadBLA(hObject, eventdata, Empty_Button, Buttons, AxesRAW, AxesZLF, DataText, ZerolineText, titles)
data = get(Empty_Button,'UserData');

data.isdata = 0;
data.isbd = 0;
data.iscut = 0;
data.iszlf = 0;
data.iszla = 0;
data.nobd = 0;
data.xbd = [];
data.ibd = [];

plot(AxesRAW,1,0,'w');
plot(AxesZLF,1,0,'w');

set(titles(3),'String','filename');
set(DataText(3), 'String', '');
set(DataText(5), 'String', '');

set(ZerolineText(4), 'String', 'not ok', 'ForegroundColor','r');
set(ZerolineText(6), 'String', 'not ok', 'ForegroundColor','r');

onoffButton(Buttons,[],2:7);

if ispc
    dlm = '\';
else
    dlm = '/';
end
if isfield(data,'PathName') == 0
    actpwd = pwd;
    if strcmp(actpwd(end-9:end), 'subfcnsBLA') == 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(6),'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')
    set(DataText(6),'String',sprintf(['Warning:\nNo matrix D in file\n"',FileName,'"']),'ForegroundColor','red');
    data.Draw = [];
    data.traw = [];
    data.xraw = [];
    set(Empty_Button,'UserData',data);
    return
else
    k = size(D,1);
    n = size(D,2);
    if min(k,n) < 1
        set(DataText(6),'String',sprintf(['Warning:\nMatrix D of bad dimension: ', num2str(k), ' x ', num2str(n)]),'ForegroundColor','red');
        data.Draw = [];
        data.traw = [];
        data.xraw = [];
        set(Empty_Button,'UserData',data);
        return
    end
    
    if min(min(isfinite(D))) == 0
        set(DataText(6),'String',sprintf('Warning:\nMatrix D has at least one nonreal entry.'),'ForegroundColor','red');
        data.Draw = [];
        data.traw = [];
        data.xraw = [];
        set(Empty_Button,'UserData',data);
        return
    end
    
    if (~exist('t')) && (exist('T')) && (max(size(T)) == k) && (min(size(T)) == 1)
        t = T;
    elseif (~exist('t')) || (max(size(t)) ~= k) || (min(size(t)) ~= 1)
        t = 0:k-1;
    end
    
    if (~exist('x')) && (exist('X')) && (max(size(X)) == n) && (min(size(X)) == 1)
        x = X;
    elseif (~exist('x')) || (max(size(x)) ~= n) || (min(size(x)) ~= 1)
        x = 0:n-1;
    end
    
    if size(x,1) < size(x,2)
        x = x';
    end
    if size(t,1) < size(t,2)
        t = t';
    end
    
    if length(x) ~= size(D,2) && length(x) == size(D,1)
        D = D';
    end
    
    if x(1) > x(2)
        x = x(end:-1:1);
        D = D(:,end:-1:1);
    end
    
    if length(t) > 1 && t(1) > t(2)
        t = t(end:-1:1);
        D = D(end:-1:1,:);
    end
    
    data.Draw = D;
    data.xraw = x;
    data.traw = t;
    
    data.D = D;
    data.x = x;
    data.t = t;
    
    plot(AxesRAW,data.x,data.D','k');
    axis(AxesRAW,'tight');
    yl = get(AxesRAW,'ylim');
    yl = [min(0,yl(1)), yl(2)*1.1];
    set(AxesRAW,'ylim',yl);
    xlabel(AxesRAW,'channel');
    hold(AxesRAW, 'off');
    
    data.yl = yl;
    
    set(titles(3),'String',['file: ', [PathName, FileName]]);
    set(DataText(3), 'String', num2str(size(data.D,1)));
    set(DataText(5), 'String', num2str(size(data.D,2)));
    set(DataText(6), 'String', '');
    
    set(ZerolineText(4), 'String', 'ok', 'ForegroundColor','k');
    
    data.isdata = 1;
    onoffButton(Buttons,2,[]);
    set(Empty_Button,'UserData',data);
end
