echo47 said:Ok, easy answer! rdsamp is a Windows console application (a command-line program), so you can't simply double-click it.
One way to run it -- Open a Windows Command Prompt, change into the directory with all the downloaded files, and run the rdsamp command:
rdsamp e0801 -l 10.0 -p > e0801.txt
Another way -- Run the rdsamp command from inside MATLAB. This assumes all the downloaded files are in your MATLAB working directory:
system('rdsamp e0801 -l 10.0 -p > e0801.txt');
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(y);
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 [url]https://www.dataq.com/applicat/articles/an14.htm[/url]
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
echo47 said:To see the full link to an14.htm, scroll up to my third message.
My previous example reads only the first two columns of data (time,voltage1). It discarded the third column (voltage2).
Try this new-and-improved example.
1. The rdsamp command includes new options to jump ahead 17.3 seconds before reading the 10.0 seconds of data.
2. The textread command now reads all three columns of data (time,voltage1,voltage2), instead of just the first two.
3. The rest of the code contains a loop that processes and plots both waveforms.
You may need to widen your web browser to avoid long-line wrap:
Code: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(y); 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 [url]https://www.dataq.com/applicat/articles/an14.htm[/url] 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
echo47 said:Hello,
I don't understand what you mean by "segment", "jump", or "capture". Sorry.
If you need to magnify an interesting area of the plot, you can use the zoom tools on the figure toolbar.
In the attached figure,,,, i wanna jump to the abnormal spike seen at the begining of the sample and fully capture it.echo47 said:I don't understand what you mean by "segment", "jump", or "capture".
Hi echoecho47 said:You want to search the data for an abnormal cardiac cycle, and then copy that cycle's data into a new array.
I don't know how to search for an abnormal cycle. Sorry.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?