A controllable nanomechanical memory element