Nuclear spins are promising candidates for quantum information processing because their good isolation from the environment precludes the rapid loss of quantum coherence. Many strategies have been developed to further extend their decoherence times. Some of them make use of decoupling techniques based on the Carr-Purcell and Carr-PurcellMeiboom-Gill pulse sequences. In many cases, when applied to inhomogeneous samples, they yield a magnetization decay much slower than that of the Hahn echo. However, we have proved that these decays cannot be associated with longer decoherence times, as coherences remain frozen. They result from coherences recovered after their storage as local polarization and thus they can be used as memories. We show here how this freezing of the coherent state, which can subsequently be recovered after times longer than the natural decoherence time of the system, can be generated in a controlled way with the use of field gradients. A similar behaviour of homogeneous samples in inhomogeneous fields is demonstrated. It is emphasized that the effects of inhomogeneities in solid-state nuclear magnetic resonance, independently of their origin, should not be disregarded, as they play a crucial role in multipulse sequences.