An electronic device includes a first electrode, a second electrode and a nanowire connected between the first and second electrodes to allow electric current flow. The nanowire is made from a conductive material exhibiting a variable resistance due to electromigration. The nanowire is repeatably switchable between two states. A voltage clamp operates through feedback control to maintain the voltage across the nanowire and prevent thermal runaway