function buttontransformAFS(hObject, eventdata, parentfig, Empty_Button, Buttons, Footnote, AxesAFS, AxesSOL, Plotsettings, SOLinfo, lcs, LCS, usmn, usmf)
set(usmn,'Value',0);
set(usmf,'Value',1);
part = get(hObject,'UserData');
data = get(Empty_Button,'UserData');
if (isfield(data,'ismatrix')*isfield(data,'isnmf')*isfield(data,'isafs') == 0) || (data.ismatrix*data.isnmf*data.isafs == 0)
    if data.ismatrix == 0 set(Footnote,'String',' Warning, no data has been loaded.','ForegroundColor','red');return;end
    if data.isnmf == 0 set(Footnote,'String',' Warning, no NMF has been computed.','ForegroundColor','red');return;end
    if data.isafs == 0 set(Footnote,'String',' Warning, no AFS has been computed.','ForegroundColor','red');return;end
end

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

bndpts = getsetvar(Plotsettings(1), 1, 200, 1, 1);
hx     = getsetvar(Plotsettings(2), 5.E-3, 5.E-1, 0, 1);
hy     = getsetvar(Plotsettings(3), 5.E-3, 5.E-1, 0, 1);

[data.Sol,tim,suc] = transformAFS(data,part,bndpts,hx,hy);

if suc == 0
    set(Footnote,'String',' Warning: AFS is empty.','ForegroundColor','red');
else
    set(Footnote,'String',['AFS Transformation-time:  ',num2str(tim),' s'],'ForegroundColor','black');
    set(SOLinfo(1),'String',[' used points: ',num2str(size(data.Sol.T,1))]);
    
    plot(AxesAFS,0,0,'w');
    if data.parts == 2
        set(parentfig,'CurrentAxes',AxesAFS);
        fill([data.AFS{1}(1), data.AFS{1}(2), data.AFS{1}(2), data.AFS{1}(1), data.AFS{1}(1)],...
             [data.AFS{2}(1), data.AFS{2}(1), data.AFS{2}(2), data.AFS{2}(2), data.AFS{2}(1)],0.9*[1 1 1]);
        hold(AxesAFS,'on');
        for i=1:2
            plot(AxesAFS,[data.AFS{1}(i), data.AFS{1}(i)], [data.AFS{2}(1), data.AFS{2}(2)], 'color',lcs(1,:),'Linewidth',2);
            plot(AxesAFS,[data.AFS{1}(1), data.AFS{1}(2)], [data.AFS{2}(i), data.AFS{2}(i)], 'color',lcs(2,:),'Linewidth',2);
        end
        if part == 1
            plot(AxesAFS,data.Sol.T(:,1),sum(data.AFS{2}(1:2))/2*ones(size(data.Sol.T(:,1))),'x','color',lcs(1,:),'Linewidth',2);
        elseif part == 2
            plot(AxesAFS,sum(data.AFS{1}(1:2))/2*ones(size(data.Sol.T(:,1))),data.Sol.T(:,1),'x','color',lcs(2,:),'Linewidth',2);
        end
        hold(AxesAFS,'off');
        axis(AxesAFS,'tight');
        xl = get(AxesAFS,'xlim');
        yl = get(AxesAFS,'ylim');
        set(AxesAFS,'xlim',[(1-sign(xl(1))*0.1)*xl(1) (1+sign(xl(2))*0.1)*xl(2)],...
            'ylim',[(1-sign(yl(1))*0.1)*yl(1) (1+sign(yl(2))*0.1)*yl(2)]);
        
        plot(AxesSOL,data.x,data.Sol.A,'color',lcs(part,:));
        axis(AxesSOL,'tight');
        yl = get(AxesSOL,'ylim');
        set(AxesSOL,'ylim',[min(0, yl(1)), 1.1*yl(2)]);
        xlabel(AxesSOL,'channel');
    else
        plotAFS(parentfig, data, AxesAFS, AxesSOL, lcs, LCS);
        hold(AxesAFS,'on');
        if data.parts == 3
            lc = lcs(part,:);
        else
            lc = [0, 0, 0];
        end
        xl = get(AxesAFS,'xlim');
        yl = get(AxesAFS,'ylim');
        plot(AxesAFS,data.Sol.T(:,1),data.Sol.T(:,2),'x','color',lc,'Linewidth',1);
        hold(AxesAFS,'off');
        set(AxesAFS,'xlim',xl,'ylim',yl);

        plot(AxesSOL,data.x,data.Sol.A,'color',lc);
        axis(AxesSOL,'tight');
        yl = get(AxesSOL,'ylim');
        set(AxesSOL,'ylim',[min(0, yl(1)), 1.1*yl(2)]);
        xlabel(AxesSOL,'channel');
    end
end

onoffButton(Buttons,[],13:16);

set(Empty_Button,'UserData',data);
