In this paper, a method to automatically extract the main information from a long-term electrocardiographic signal is presented. This method is based on techniques of pattern recognition applied to speech processing, like dynamic time warping, and trace segmentation. In order to fulfill this objective, a clustering process is applied to the set of beats present within the electrocardiographic signal. From each group obtained, one beat is taken as representative of all the beats in that cluster. Since the discrete sequences of beat features can have different length, the clustering process takes place in a pseudo-metric space, and the dissimilarity measure is calculated using dynamic programming. Due to the same reason, the clustering algorithm employed is the KMedians, including some optimizations to reduce the computational cost. An experimental comparative study, using four different feature extraction methods, linear, and non-linear temporal alignment of sequences, is performed usi...