Electrochemical control and selection of the structural and magnetic properties of cobalt nanowires