name = input('Name of the output file :', 's');
numplot = input('Number of the detectors: ');
numlayer = input('Number of different input atomic layers: ');

longdata = textread(name,'%f','headerlines',(12 + numplot +numlayer));
numpoint = length(longdata)/(numplot+2);

sorted = [];

for im = 0:numpoint-1
    for in = 0:numplot+1
        tempposition = 1 + im*(numplot+2) + in;
        sorted(im+1,in+1) = longdata(tempposition);
    end
end

xp = sorted(:,1);

for i = 0:numplot-1
    figure;
    yp = sorted(:,i+3);
    plot(xp,yp);
    axis([min(xp) max(xp) 0 max(yp)]);
    title(['Detector#' int2str(i+1)]);
end
