Experimental study of plasma injection into a programmed magnetic field