shaikh105
Member level 1
I have tried this code below for plotting ecg from physionet as given by echo47 during my last conversations
that time it worked but now when i am get back to it it is not working
i have downloaded the rdsamp.exe file,wfdb-10.4.dll file and the libcurl-3.dll and downloaded the .atr, .dat and .hea files in the matlab work directory but this didinot work
the error i get is """" Erroro in fs=1/t2-t1
i also notice that that t and y vectors are also null means textread is not ok
but rdsamp work on command line
any body help please especially if echo47 can
i am grateful
clear;
system('rdsamp -r e0801 -f 17.3 -l 10.0 -p > e0801.txt'); % jump 17.3 seconds, read 10 seconds
[t,y,1),y,2)] = textread('e0801.txt','%f %f %f'); % read time and voltages from file
fs = 1 / (t(2) - t(1)); % sample rate, hertz
period = 0.96; % cardiac period, seconds
N = length;
t = (0 : N-1) / fs;
for n = 1:2 % for each voltage waveform
subplot(4,1,n*2-1); plot(t,y,n)); xlim([0 max(t)]);
title('Input Data','FontWeight','bold'); xlabel('Seconds'); ylabel('Millivolts');
xlim1 = xlim; ylim1 = ylim; % remember plot limits
%
% Subtract baseline drift. See https://www.dataq.com/applicat/articles/an14.htm
z,n) = y,n) - smooth(y,n),round(fs*period));
subplot(4,1,n*2-0); plot(t,z,n)); xlim([0 max(t)]);
title('Subtract Baseline Drift','FontWeight','bold'); xlabel('Seconds'); ylabel('Millivolts');
xlim(xlim1);
end
that time it worked but now when i am get back to it it is not working
i have downloaded the rdsamp.exe file,wfdb-10.4.dll file and the libcurl-3.dll and downloaded the .atr, .dat and .hea files in the matlab work directory but this didinot work
the error i get is """" Erroro in fs=1/t2-t1
i also notice that that t and y vectors are also null means textread is not ok
but rdsamp work on command line
any body help please especially if echo47 can
i am grateful
clear;
system('rdsamp -r e0801 -f 17.3 -l 10.0 -p > e0801.txt'); % jump 17.3 seconds, read 10 seconds
[t,y,1),y,2)] = textread('e0801.txt','%f %f %f'); % read time and voltages from file
fs = 1 / (t(2) - t(1)); % sample rate, hertz
period = 0.96; % cardiac period, seconds
N = length;
t = (0 : N-1) / fs;
for n = 1:2 % for each voltage waveform
subplot(4,1,n*2-1); plot(t,y,n)); xlim([0 max(t)]);
title('Input Data','FontWeight','bold'); xlabel('Seconds'); ylabel('Millivolts');
xlim1 = xlim; ylim1 = ylim; % remember plot limits
%
% Subtract baseline drift. See https://www.dataq.com/applicat/articles/an14.htm
z,n) = y,n) - smooth(y,n),round(fs*period));
subplot(4,1,n*2-0); plot(t,z,n)); xlim([0 max(t)]);
title('Subtract Baseline Drift','FontWeight','bold'); xlabel('Seconds'); ylabel('Millivolts');
xlim(xlim1);
end