The present invention provides a
magnet (100), which comprises a body (101) having a first and a second section (103, 104), and a slide (108) arranged to be movable relative to the body (101) between a first and a second position. The slide (108) comprises a permanent
magnet (109), and a first and a second
pole piece (110, 111) that are attached to opposite magnetic pole surfaces of the permanent
magnet (109). The first section (103) comprises a hole (106) that opens into a first cavity (107) of the body (101), the bottom of the first cavity (107) being delimited at least partly by the second section (104). The slide (108) is movably arranged in the hole (106) so that the second
pole piece (111) is directed towards the bottom of the first cavity (107), wherein at the first position of the slide (108),
magnetic flux generated by the permanent magnet (109) is short-circuited by the first section (103), and at the second position of the slide (108),
magnetic flux generated by the permanent magnet (109) is directed through the first and the second section (103, 104).