Controlling the function of carbon nanotube devices with re-writable charge patterns