I seem to have hit the answer, please do let me know if there is an issue I didn't see. created a T = M1-M2 , initiate S = zeros(length(M1),1).
Then S(ABS(T)>Theta)=sign(T(ABS(T)>Theta))
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!