U shaped magnet: One metal plate is placed across the two poles of the U shaped magnet.
Bar magnet: Bar magnets should be kept in pairs with opposite poles on the same side. Use two metal plates and one wooden block, arrange them as shown in the figure.