Comparing rows of a matrix with some row vectors
In Matlab, unlike C, you have to vectorize your code.
A first step would be to understand how to use find like this:

i1=70:2000;
j1=find(D1(B(v,1),i1)==L);


and:

if j1&gt;64             
       m_A1(i,j) = all( A(i,j-63:j)==A(B(v,1),j1-63:j1) );
end 


You may also find any and all useful. Eventually you should be able to eliminate all the for loops and if statements.