Erectile dysfunction related to medical/physical causes is often treatable but less commonly curable. In some cases of medication-induced erectile dysfunction, changes in medication may improve erections. Similarly, in men with a history of arterial trauma, surgical intervention can restore erectile dysfunction. In most cases of ED associated with a medical condition, treatment allows one to have an erection "on demand" or with the aid of medications/device (but not spontaneous).
The most common diagnostic test for erectile dysfunction is called penile ultrasound. This test uses sound waves to look for abnormal penile blood supply. Another test that may be done is nocturnal penile tumescence testing, in which a type of computer is attached to the penis to see if nighttime erections are occurring. If a young man is having nighttime erections but can’t get an erection during sex, a psychological cause becomes more likely.
It's also important to remember that your mental health plays as much a part of your sexual ability as your physical health. Stress and other mental health concerns can cause or make erectile dysfunction worse. Minor health problems may slow your sexual response, but the accompanying anxiety that comes with the slow sexual response can shut things down entirely.
Men with diabetes tend to develop erectile dysfunction 10 to 15 years earlier than men without diabetes. As men with diabetes age, erectile dysfunction becomes even more common. Above the age of 50, the likelihood of having difficulty with an erection occurs in approximately 50% to 60% of men with diabetes. Above age 70, there is about a 95% likelihood of having some difficulty with erectile dysfunction.