A rational design for the separation of metallic and semiconducting single-walled carbon nanotubes using a magnetic field.