Studies of magnetic dipole transitions in highly charged argon and barium using an electron beam ion trap