Impotent men can't masturbate. But impotence is a very relative term. One can be impotent temporarily, or with particular woman while potent with other women. One can masturbate because of privacy, safety while he becomes impotent with a woman. So leave it on to us to define potency in a given individual.