you didn't mentioned,
what is your age,
what was your ultrasound
what medicines doctor prescribed to you,
what is your height and weight, is there any recent weight gain?,
any associated medical disorders you are having?
One possibility is presence of PCOD(poly cystic ovarian disease
). Which is characterized by irregular periods
Your doctor might have prescribed you insulin sensitizers like metformin
for regularization of your periods.
Once you have started the medicine you have to take it until your problem gets solved and your doctor says to stop.
Another possibility is presence of any thyroid abnormality, may be for that your doctor prescribed you medicines.
These also should not be stopped until normal levels of hormones attained.
So, better you visit your doctor again and take complete treatment.