[L,I] = ismember(A,B);
vals = A(I~=0);
should work. The extra 'find' step is un-necessary if you use the second output of ismember. If you prefer though:
L = ismember(A,B);
I = find(L);
vals = A(I);
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!