Nanowires Memorize by Changing Phase