Of course do as your doctor recommends, but often you can safely work around injuries. If you can find a way to do your desired exercise without stressing the affected joint/muscle then you are home free. This can take some creativity but for most injuries except back injuries you can work around them.
Turns out my intense ankle pain was probably just s repetitive use injury caused by the extreme cycling I am doing. My first idea how to take the pressure off my ankle was to make a leg cast out of bailing wire and duct tape- both things many engineers like myself are never without. As cool looking as a duct tape cast would have been, it would have caused as many problems as it solved. Its not an elegant solution though so I kept looking. The “aha moment” took embarassingly long. As an avid cyclist for 40 years I have put the pedals under my toes/ball so the calves could add max power to the stroke so the idea of cycling on my heels never occured to me till I was faced with having to quit. By pedaling on the heels, there is no torque or flexing of the ankle whatsoever- bingo!
So I lowered my seat 2″ and pedaled on my heels for 120 miles
This “Tour de Hans” cycling is by far the most physically challenging thing I have personally ever done. Day after day of 120 mile, 12hr days virtually nonstop cycling. Talk about a high rep leg workout, in a week thats 302,000 reps! The serious ankle problem has slowed me down a lot on my bike, and really showed me down walking- about all I can muster is a slow shuffle. Getting bad saddle sores I expected and Im amazed that it took till today for them to get bad. The knees are ok, probably only because im on ibuoprofin for my ankle. Im glad that the Tour de Hans is almost over, otherwise I might have to be medivaced out of Germany :)