Hello First Noel,welcome to JA/ Pearl my name is***** will try to answer your electrical question today with the best of my ability.
Full disclosure I was studying for a year to become an electronics engineer, but with even that Your question is advanced and probably a bit above of what the average electrician here on the site can answer, but I will add some insight you may or may not already know to your question.
Depending on the angle of installation/ orientation it can be difficult to limit magnetic flux lines, mostly in electrical installations where EMI or magnetic interference is an issue devices are equipped with ferrous metal shields in order to keep low voltage electronics from unwanted effects , this is pretty common for electricians to see when installing equipment.
Beyond a physical barrier to flux lines there are on going studies about using equal force magnetic sources to repel and isolate equipment from unwanted sources. So actually use a matching magnetic field intensity to repel unwanted sources sounds like is more what is you are after. There are companies online that install grids under ground around buildings to prevent large scale interference, something on a small scale might be possible in your application if you can match the orientation of the flux lines and repel the PM's flux with a electronically controlled magnet of matching strength and angle.
I don't think there is a simple electronic solution to the problem, but I hope I gave you some information on how you might research going about how to solve it . Thanks for your question, please do not forget to rate me and have a wonderful day !