I resolved this using the Fourier block in Simulink Specialized powersystem toolbox. It allows to extract any harmonic order and phase angle form the input signal. To extract exact harmonic magnitudes and phases, run the simulation for atleast 10 cycles of fundamental frequency (i.e 0.2 sec for 50 Hz) or 12 cycle at 60 Hz system.
https://uk.mathworks.com/help/sps/powersys/ref/fourier.html