ANYTHING which makes you feel uncomfortable is not ok. We teach children that, it applies to adults too.
There is a difference between medical touch and sexual touch, and it might be that your instincts are saying to you that his was the latter. It's ok if that the case. You have a right to feel like that and to remember it as you do. There is a chance you may objectively be wrong, and he wasn't thinking of it as anything other than a medical exam, but you still have a right to your feelings, and really I'd trust your instincts over anything else. He made you feel uncomfortable. He didn't ask your permission, there wasn't a chaperone.
In most of these situations doctors don't assault their patients, it's good to know how to check your breasts, there isn't always the need for a chaperone, blah, blah, blah. Point is, you felt uncomfortable, you can't shake that off, you have every right to feel that way. I guess the main thing you can take from it is that if a male doctor wants to do any kind of intimate exam in future you know to ask for a chaperone in case it brings up feelings for you, and just so you're sure you are safe.
An assault can be such a shock, people do freeze, so equally if you're going into a doctor in the future it might reassure you to have a think about what happens if someone is doing something you aren't comfortable with and rehearse being assertive and saying 'please stop that, I would like a chaperone' just so you get your power back in these situations. Hopefully nothing like this will happen again though.