Magnetic field controllable nonvolatile resistive switching effect in silicon device