function buttontranspose(hObject, eventdata, Empty_Button,Button,AFS, LockMode,Footnote, AxesD, AxesAFS, AxesSOL, Datainfo, SVDinfo,EPSinfo, Polysettings, usmn, usmf,borg,one_x)
set(usmn,'Value',0);
set(usmf,'Value',1);

set(borg,'Value',1);
set(one_x,'Value',0);

data = get(Empty_Button,'UserData');



if (isfield(data,'ismatrix') == 0) || (data.ismatrix == 0)
    set(Footnote,'String',' Warning, no data has been loaded.','ForegroundColor','red')
    return
end

data.isafs = 0;
data.isExpert1 = 0;
data.isExpert2 = 0;
data.isLastClickLockMode = 0;



data.D0=data.D0';

D=data.D0;
[k,n]=size(D);


for i=1:k
    col_pos=0;
    col_neg=0;
    for j=1:n
        if D(i,j)>0
            col_pos=col_pos+D(i,j);
        else
            col_neg=col_neg-D(i,j);
        end
    end

end

temp=data.x;
data.x=data.t;
data.t=temp;

[U,S,V] = svds(D,6);


Dtrunc=U(:,1:3)*S(1:3,1:3)*V(:,1:3)';
data.Uraw = U(:,1:3);
if min(k,n)>3
    data.Sraw = S(1:4,1:4);
else
    data.Sraw=S(1:3,1:3);
end
data.Vraw = V(:,1:3);
data.Dtrunc=[];
data.Draw=[];
data.Dtrunc=Dtrunc;
data.Draw=Dtrunc;

e = ones(n,1);
data.D_scal=[];

for i = 1:k
        if max(data.D0(i,:))>1.0e-12
            data.D_scal(i,:)=Dtrunc(i,:)/(Dtrunc(i,:)*e);
        else
           data.D_scal(i,:)=zeros(1,n);
           data.Dtrunc(i,:)=zeros(1,n);
       end
    end

[data.U_scal,data.S_scal,data.V_scal]=svds(data.D_scal,3);
data.sum_v1=ones(1,size(data.V_scal,1))*data.V_scal(:,1);
data.sum_v2=ones(1,size(data.V_scal,1))*data.V_scal(:,2);
data.sum_v3=ones(1,size(data.V_scal,1))*data.V_scal(:,3);


for i=1:3
    if -min(data.V_scal(:,i))>max(data.V_scal(:,i))
        data.V_scal(:,i)=-data.V_scal(:,i);
        data.U_scal(:,i)=-data.U_scal(:,i);
    end
end

for i=1:3
    if -min(data.Vraw(:,i))>max(data.Vraw(:,i))
        data.Vraw(:,i)=-data.Vraw(:,i);
        data.Uraw(:,i)=-data.Uraw(:,i);
    end
end





set(Empty_Button,'UserData',data);



data.pb2 = 1;

set(Datainfo(2),'String',['spectra: ',num2str(size(data.Draw,1))]);
set(Datainfo(3),'String',['channels: ',num2str(size(data.Draw,2))]);
hold off
plot(AxesD,data.x,data.Draw','k');
axis(AxesD,'tight');
yl = get(AxesD,'ylim');
set(AxesD,'ylim',[min(0,yl(1)), yl(2)*1.1]);
xlabel(AxesD,'channel');

hold(AxesAFS,'off');
plot(AxesAFS,0,0,'w');
hold(AxesSOL,'off');
plot(AxesSOL,1,0,'w');

[m,n]=size(data.Draw);

s=data.Dtrunc(1,1);
for i=2:n
    s=s+data.Dtrunc(1,i);
end

  D=data.D_scal;
    I=[];
    for i=1:m
        if min(D(i,:))/max(abs(D(i,:)))>-0.1 && max(D(i,:))>3e-3
            I=[I, i];
        end
    end
    D=D(I,:);

if min(n,k)>3
    if min(min(D))>-1.0e-14 && S(4,4)<1.0e-12

        minD=0;
    else
        minD=min(min(D));
        if minD<0
            minD=min(-10^(-8),minD);
        end
        if abs(minD)<1.0e-14
            minD=0;
        end
    end
else
    if min(min(D))>-1.0e-14 

        minD=0;
    else
        minD=min(min(D));
        if minD<0
            minD=min(-10^(-8),minD);
        end
        if abs(minD)<1.0e-14
            minD=0;
        end
    end

end

data.EPSd=minD;
set(EPSinfo(2),'String',[num2str(0)]);

if minD>=0
    set(EPSinfo(1),'String',[' min(A): ',num2str(0)]);
    set(EPSinfo(3),'String',[num2str(0)]);
    data.EPSa=0;
    data.EPSa=0;
    
    
else
    set(EPSinfo(1),'String',[' min(A): ',num2str(minD)]);
    minD=ceil(-minD*10^6)/10^6;
    data.EPSa=minD;
    data.EPSc=0.000001;
    minA=max([minD 1e-4]);
    set(EPSinfo(3),'String',[num2str(minA)]);
    set(EPSinfo(2),'String',[num2str(1e-8)]);
end

data.polygon=0;
data.Borgen=1;
onoffButton_BKP(Button,[],4:8);
onoffButton_BKP(AFS,[],1:3);
onoffButton_BKP(LockMode,[],2:5);

data.isExpert1=0;
data.isExpert2=0;

data.AFSL_B=[];
data.AFSL2_B=[];
data.AFSL_SV=[];
data.AFSL2_SV=[];
data.numb_segmentsL2=[];
data.numb_segmentsL2=0;
data.numb_segmentsL=[];
data.numb_segmentsL=0;
set(Empty_Button,'UserData',data);




set(Empty_Button,'UserData',data);

