Switching Magnetic Properties by a Mechanical Motion