function buttonlockedAFS(hObject, eventdata, parentfig, Empty_Button, Buttons, Footnote, AxesAFS, AxesSOL, Polysettings, Plotsettings, lcs, LCS)
part = get(hObject,'UserData');
data = get(Empty_Button,'UserData');
if (isfield(data,'ismatrix')*isfield(data,'isnmf')) || (data.ismatrix*data.isnmf == 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
end

MaxLang = getsetvar(Polysettings(5), 3, inf, 1);
MaxFunC = getsetvar(Polysettings(4), 30, inf, 1);
epsFun = 1.e-10;
epsKante = getsetvar(Polysettings(3), 1.E-8, inf, 0);
epsRand = getsetvar(Polysettings(2), 1.E-8, inf, 0);
noiseC = -getsetvar(Polysettings(1), 1.E-13, inf, 0);
noiseA = noiseC;

if max(noiseC, noiseA) > -1.E-11
    noiseC = 100*noiseC;
    noiseA = 100*noiseA;
elseif max(noiseC, noiseA) > -1.E-6
    noiseC = 10*noiseC;
    noiseA = 10*noiseA;
end

if part == 1
    set(Footnote,'String',' C routine in progress ... (press CTRL + C in the command window to cancel) ...','ForegroundColor','black');
    fprintf(' C routine (AFS Lock-Mode 1) in progress ... (press CTRL + C to cancel) ... ');
    set(hObject,'Enable','off');
    [AFS1, totalpoin1, calls1, bisec1, dimP1, tim, suc] = computelockedAFS1(MaxLang, MaxFunC, epsFun, epsKante, epsRand, noiseC, noiseA,...
                                                                        data.s, data.U, data.S, data.V, data.InitT, data.calcp);
    
    set(hObject,'Enable','on');
    if suc == -2
        fprintf('computation canceled.\n');
        set(Footnote,'String','Lock-Mode 1: Computation canceled.','ForegroundColor','red');
        return;
    end
    fprintf(' ready, time: %2.2f s.\n',tim);
    
    if suc == -1
        set(Footnote,'String','Lock-Mode 1: Locked point is not valid.','ForegroundColor','red');
        data.isExpert1 = 0;
        data.isExpert2 = 0;
    else
        set(Footnote,'String',['Lock-Mode 1: Computation-time:  ',num2str(tim),' s.'],'ForegroundColor','black');
        
        data.isExpert1 = 1;
        data.isExpert2 = 0;
        data.AFS1 = AFS1;
        data.dimP1 = dimP1;
        data.isLastClickLockMode = 0;

        data = plotlockedAFS(parentfig, data, AxesAFS, AxesSOL, lcs, LCS, part);

        onoffButton(Buttons,15,[14 16]);
    end
elseif part ==2
    set(Footnote,'String',' C routine in progress ... (press CTRL + C in the command window to cancel) ...','ForegroundColor','black');
    fprintf(' C routine (AFS Lock-Mode 2) in progress ... (press CTRL + C to cancel) ... ');
    set(hObject,'Enable','off');
    [AFS2, totalpoin2, calls2, bisec2, dimP2, tim, suc] = computelockedAFS2(MaxLang, MaxFunC, epsFun, epsKante, epsRand, noiseC, noiseA,...
                                                                        data.s, data.U, data.S, data.V, data.InitT, data.calcp);
    
    set(hObject,'Enable','on');
    if suc == -2
        fprintf('computation canceled.\n');
        set(Footnote,'String','Lock-Mode 2: Computation canceled.','ForegroundColor','red');
        return;
    end
    fprintf(' ready, time: %2.2f s.\n',tim);
    
    if suc == -1
        set(Footnote,'String','Lock-Mode 2: Locked point is not valid.','ForegroundColor','red');
        data.isExpert2 = 0;
    else
        set(Footnote,'String',['Lock-Mode 2: Computation-time:  ',num2str(tim),' s.'],'ForegroundColor','black');
        
        data.isExpert2 = 1;
        data.AFS2 = AFS2;
        data.dimP2 = dimP2;
        data.isLastClickLockMode = 0;

        data = plotlockedAFS(parentfig, data, AxesAFS, AxesSOL, lcs, LCS, part);

        onoffButton(Buttons,16,[]);
    end
end
set(Empty_Button,'UserData',data);
