How to use MATLAB's $\tt xcorr$ to find index of a section inside a whole recording?
Tried with taking absolute value of the maximum ? I have updated the code, see if that works for you... 

[ff,ind]=max(abs(c)); % finding the index of the offset

M=A(ind:ind+(length(B))-1); % the selection from A based on the new index

plot(B);
hold;
plot(M);