function buttontwist_x(hObject, eventdata, parentfig,Empty_Button,LockMode,Footnote, AxesAFS,AxesSOL)

data = get(Empty_Button,'UserData');

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

data.IP_B(:,2)=-data.IP_B(:,2);
data.FP_B(:,2)=-data.FP_B(:,2);
data.Tbnd_B(:,2)=-data.Tbnd_B(:,2);
data.Fbnd_B(:,2)=-data.Fbnd_B(:,2);

data.IP_SV(:,2)=-data.IP_SV(:,2);
data.FP_SV(:,2)=-data.FP_SV(:,2);
data.Tbnd_SV(:,2)=-data.Tbnd_SV(:,2);
data.Fbnd_SV(:,2)=-data.Fbnd_SV(:,2);

for i=1:data.numb_seg
    data.segments_B{i}(:,2)=-data.segments_B{i}(:,2);
    data.segments_SV{i}(:,2)=-data.segments_SV{i}(:,2);
end


data.Vraw(:,3)=-data.Vraw(:,3);
data.Uraw(:,3)=-data.Uraw(:,3);
data.V_scal(:,3)=-data.V_scal(:,3);
data.U_scal(:,3)=-data.U_scal(:,3);
data.sum_v3=-data.sum_v3;

for i=1:data.numb_seg

         h=data.mima_B(i,3);
        data.mima_B(i,3)=-data.mima_B(i,4);
        data.mima_B(i,4)=-h;
         h=data.mima_SV(i,3);
        data.mima_SV(i,3)=-data.mima_SV(i,4);
        data.mima_SV(i,4)=-h;


end

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);
    data.FixPoint1_B=[];
    data.FixPoint1_SV=[];
    data.FixPoint2_B=[];
    data.FixPoint2_SV=[];
    data.FixPoint3_B=[];
    data.FixPoint3_SV=[];
    
set(Empty_Button,'UserData',data);

plotAFS_BKP(Empty_Button,AxesAFS)
onoffButton_BKP(LockMode,2,3:5);
hold(AxesSOL,'off');
plot(AxesSOL,1,0,'w');
if data.Borgen==1

dlmwrite('subfcnsBKP/wrap/IP.txt',data.IP_B,'precision','%15.15e','delimiter',' ');
dlmwrite('subfcnsBKP/wrap/FP.txt',data.FP_B,'precision','%15.15e','delimiter',' ');
dlmwrite('subfcnsBKP/wrap/AFS.txt',data.Tbnd_B,'precision','%15.15e','delimiter',' ');
dlmwrite('subfcnsBKP/wrap/AFSout.txt',data.Fbnd_B,'precision','%15.15e','delimiter',' ');
else
    dlmwrite('subfcnsBKP/wrap/IP.txt',data.IP_SV(:,:),'precision','%15.15e','delimiter',' ');
dlmwrite('subfcnsBKP/wrap/FP.txt',data.FP_SV,'precision','%15.15e','delimiter',' ');
dlmwrite('subfcnsBKP/wrap/AFS.txt',data.Tbnd_SV,'precision','%15.15e','delimiter',' ');
dlmwrite('subfcnsBKP/wrap/AFSout.txt',data.Fbnd_SV,'precision','%15.15e','delimiter',' ');
end