Characterization of the deformation state of magnesium by electrical resistance