Hello,
I need help reading in ECG data from a CSV file and then outputting it as a PDF file. The ECG data consists of time values in seconds and voltage values in volts.
Please note the following specific requirements for the PDF presentation:
1. axis scaling:
- A small box should represent 0.02 seconds, while a large box should represent 0.1 seconds.
- A small box should represent 0.01 mV, and a large box should represent 0.5 mV.
2. formatting:
- The X-axis should show time in seconds, and the Y-axis should show voltage in mV.
3. PDF output:
- The PDF document should be in landscape format and contain multiple lines of the ECG
Could you please tell me how I can implement the scaling in the PDF? I would also be grateful for sample code or specific functions that I can use to fulfil these requirements.
data = readtable('ecg_sample.csv', 'Delimiter', ';');
set(gcf,'PaperUnits','centimeters');
set(gcf,'PaperSize',[29.7 21]);
fig.PaperUnits = 'centimeters';
fig.PaperPosition = [0 0 29.7 21];
fig.Units = 'centimeters';
plot(data.timesincestart(1:8000), data.leadVoltage(1:8000),'LineWidth', 2);
set(gca, 'GridLineStyle', '-');
set(gca, 'GridAlpha', 0.5);
set(gca, 'GridColor', 'k');
ax.MinorGridLineStyle = '-';
ax.XAxis.MinorTick = 'on';
ax.XAxis.MinorTickValues = 0:0.02:5;
ax.XAxis.MinorTick = 'on';
yticks(-0.0004:0.00005:0.0002);
ax.YAxis.MinorTick = 'on';
ax.YAxis.MinorTickValues = -0.0004:0.00001:0.0002;
ax.DataAspectRatio = [2000 1 1];
set(gca, 'XTickLabel', []);
set(gca, 'YTickLabel', []);
print(fig,'myFigPDF','-dpdf','-r1200');