Researchers find a new way to control magnets