Detection of similar segments of two signal I have two signals, the first is a reference signal from which I selected a segment.

I'm trying to find which segment of the other signal is the most similar to this selected segment. 

I'd be glad to have some ideas.
You could use correlation between the two signals or a matched filter in which you set the filter coefficients as the samples from the selected segment inverted in time. In matlab it would be something like

coef = knownSegment (end:-1:1,:);

minSize = length(other_signal) + length(knownSegment) - 1;
N = 2^nextpow2(minSize);
OUT = ifft(fft(other_signal,N).*fft(coef,N));


Then you find the maximum value of variable OUT and at that point in time the two signals are most similar