A health care provider might use an electrocardiogram to determine or detect: Irregular heart rhythms (arrhythmias) If blocked or narrowed arteries in the heart (coronary artery disease) are causing chest pain or a heart attack. Whether you have had a previous heart attack.