Indirect detection of magnetic resonance by heteronuclear two-dimensional spectroscopy