function [AFS1, totalpoin1, calls1, bisec1, dimP1, tim, suc] = computelockedAFS1(MaxLang, MaxFunC, epsFun, epsKante, epsRand, noiseC, noiseA, s, U, S, V, InitT, calcp)

k = size(U,1);
n = size(V,1);

actpwd = pwd;
cd(calcp);

dlmwrite('wrap/allg.txt',[k;n;s;MaxLang;MaxFunC],'precision','%d');
dlmwrite('wrap/allg.txt',[epsFun;epsKante;epsRand;noiseC;noiseA],'-append','precision','%e');
dlmwrite('wrap/L.txt',U*S(:,1:s),'precision','%15.15e','delimiter',' ');
dlmwrite('wrap/R.txt',V(:,1:s)','precision','%15.15e','delimiter',' ');
dlmwrite('wrap/InitT.txt',InitT,'precision','%15.15e','delimiter',' ');
dlmwrite('wrap/tim.txt',0,'precision','%d');

arch = computer('arch');

set(gcf,'Pointer','Watch');
pause(0.5);
if (strcmp(arch,'maci64') == 1) || (strcmp(arch,'maca64') == 1)
    system('./AFScomputationMAC64.exe 5');
elseif strcmp(arch,'win32') == 1
    system('AFScomputationWINDOWS32.exe 5');
elseif strcmp(arch,'win64') == 1
    system('AFScomputationWINDOWS64.exe 5');
elseif strcmp(arch,'glnx86') == 1
    system('./AFScomputationUNIX32.exe 5');
elseif strcmp(arch,'glnxa64') == 1
    system('./AFScomputationUNIX64.exe 5');
else
    fprintf(2,'No executable version for this type of system.\n');
    suc = -2;
    tim = 0;
    d = [0 0];
    totalpoin1 = 0;
    calls1 = 0;
    bisec1 = 0;
    AFS1 = {};
    set(gcf,'Pointer','arrow');
    cd(actpwd);
    return;
end
set(gcf,'Pointer','arrow');

tim = load('wrap/tim.txt');
if tim(1) == 0
    suc = -2;
    d = [0 0];
    totalpoin1 = 0;
    calls1 = 0;
    bisec1 = 0;
    AFS1 = {};
else
    tim = tim(2);
    results = load('wrap/AFSLock1.txt');

    if (results(1,1) == 1) && (results(1,2) == 1)
        suc = 1;
        d = results(2,:);
        totalpoin1 = d(1)+d(2);
        calls1 = results(3,1);
        bisec1 = results(3,2);

        AFS1{1} = results(4:3+d(1),:);
        AFS1{2} = results(4+d(1):3+d(1)+d(2),:);
    else
        suc = -1;
        d = [0 0];
        totalpoin1 = 0;
        calls1 = 0;
        bisec1 = 0;
        AFS1 = {};
    end
end

dimP1 = d;

cd(actpwd);
    
