Preparation and magnetic properties of Co and Ni nanowire arrays