My code is not producing the anticipated figure for a time, EKG signal plot
Afficher commentaires plus anciens
I wrote a code to import a csv file full of EKG data. I have cut it down for the purpose of space, but I have tried altering the cell formats to be mm:ss.SSS and adding 0's to make it exact, but it is not plotting anything. The amount of EKG signal samples (10,000) I have is up to 10 seconds, but the figure being produced is up to 20 minutes. I looked up the function of duration and implemented several of the examples from there, but this is the closest I have gotten to getting my code to run without errors, but it is not plotting anything. When I plot just the ekg data it creates a figure, but it isn't the correct EKG wave output form as the x-axis should be time and not samples (which is how it plots when just saying plotATM(ekg_data) in the command function). Any help would be appreciated.
% read the CSV file
data = readtable('samples (4).csv')
% extract the EKG signal column and convert to a numeric array
ekg_data = str2double(table2array(data(:, 2)));
% extract the time column and convert to a duration array
infmt = 'mm:ss.SSS';
time = duration(data{:, 1}, 'InputFormat', infmt);
% plot the EKG signal as time vs. signal
plot(time, ekg_data);
xlabel('Time');
ylabel('Signal (mV)');
title('EKG signal');
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Correlation and Convolution dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

