function alignment = pairwise_traceback(alignment)

n = length(alignment.seq01) + 1;

m = length(alignment.seq02) + 1;

    if m>n

       pairwise_align=zeros(2,2*(m-1));

    else

       pairwise_align=zeros(2,2*(n-1));

    end

    aligned=length(pairwise_align);

    clear pairwise_align

    temp_direction_matrix = alignment.direction_matrix(m,n);

    i=m;

    j=n;

    k=n-1;

    l=m-1;

while temp_direction_matrix

    if alignment.direction_matrix(i,j) == 92

       pairwise_align(1,aligned)=alignment.seq01(k);

       pairwise_align(2,aligned)=alignment.seq02(l);

       i=i-1;

       j=j-1;

       k=k-1;

       l=l-1;

       aligned=aligned-1;

    elseif alignment.direction_matrix(i,j) == 62

       pairwise_align(1,aligned)=alignment.seq01(k);

       pairwise_align(2,aligned)='-';

       j=j-1;

       k=k-1;

       aligned=aligned-1;

    elseif alignment.direction_matrix(i,j) == 94

       pairwise_align(1,aligned)='-';

       pairwise_align(2,aligned)=alignment.seq02(l);

       i=i-1;

       l=l-1;

       aligned=aligned-1;

    end

    temp_direction_matrix =alignment.direction_matrix(i,j);

end

pairwise_align=pairwise_align(1:2,aligned+1:length(pairwise_align));


alignment.temporary_pair_align = pairwise_align;