If you want the angle in all four quadrants (relative to your initial reference vector), there is a way. All vectors are from the origin here:
If v1 is your first vector defined as:
v1 = [v1(1) v1(2)]'; % v1, v2 are both column vectors
with v2 defined similarly,
a1r = atan2(v1(2),v1(1)); % radian angle of v1
rotmtx = @(theta)([cos(theta) sin(theta); sin(theta) cos(theta)]); % rotation matrix
rota1r = rotmtx(a1r); % rotation matrix to a1r
v1rot = rota1r * v1; % check rotated v1
v2rot = rota1r * v2; % calculate rotated v2
Using atan2 on the rotated v2 vector will give you angles (0, pi) and (0, pi). Add 2*pi to the negative angles to put all of them into (0, 2*pi).
I sketched this out to get you started, although I coded it in full to be sure it produced correct results. Experiment with it to see how it works. There may be better and more efficient methods, but this one was fun to work through.
