function [traces] = traces_cutting(c_traces, s_traces)

    [x,y] = size(c_traces);
    min_velikost = 1000000;
    max_velikost = 0;
    
     for smycka = 1 : 2  
        for i = 1 : x   
            for j = 1 : y
                if s_traces(i,j) < 2.5
                    zacatek = j;
                    break
                end
            end
    
            for j = 1 : y
                if (s_traces(i,j) > 2.5) && (j > 50000)
                konec = j-1;
                break;
                end
            end
            
            pom = c_traces(i, zacatek:konec);
            [r,s] = size(pom);
            
            if smycka == 1
                if min_velikost > s;
                    min_velikost = s;
                elseif max_velikost < s;
                    max_velikost = s;
                end
            elseif smycka == 2
                meas = sprintf('Orezavam: %s / %s.', num2str(i), num2str(x));
                disp(meas);
                pom = pom(:,1:min_velikost);
                traces(i,:) = pom;
            end
            
        end
     end
     
end