Methods of magnetic field switching for biomedical and power applications