how to remove base line wander of ECG in physio bank data base?

11 views (last 30 days)
how to use this plotATM code to remove the baseline wander in ecg.. i could nor run this code..so plz help me...ya please give me alternative method by which we remove the base line wander noise from ecg..? plz help
function plotATM(Name)
% usage: plotATM('RECORDm')
%
% This function reads a pair of files (RECORDm.mat and RECORDm.info) generated
% by 'wfdb2mat' from a PhysioBank record, baseline-corrects and scales the time
% series contained in the .mat file, and plots them. The baseline-corrected
% and scaled time series are the rows of matrix 'val', and each
% column contains simultaneous samples of each time series.
%
% 'wfdb2mat' is part of the open-source WFDB Software Package available at
% http://physionet.org/physiotools/wfdb.shtml
% If you have installed a working copy of 'wfdb2mat', run a shell command
% such as
% wfdb2mat -r 100s -f 0 -t 10 >100sm.info
% to create a pair of files ('100sm.mat', '100sm.info') that can be read
% by this function.
%
% The files needed by this function can also be produced by the
% PhysioBank ATM, at
% http://physionet.org/cgi-bin/ATM
%
% plotATM.m O. Abdala 16 March 2009
% James Hislop 27 January 2014 version 1.1
infoName = strcat(Name, '.info');
matName = strcat(Name, '.mat');
Octave = exist('OCTAVE_VERSION');
load(matName);
fid = fopen(infoName, 'rt');
fgetl(fid);
fgetl(fid);
fgetl(fid);
[freqint] = sscanf(fgetl(fid), 'Sampling frequency: %f Hz Sampling interval: %f sec');
interval = freqint(2);
fgetl(fid);
if(Octave)
for i = 1:size(val, 1)
R = strsplit(fgetl(fid), char(9));
signal{i} = R{2};
gain(i) = str2num(R{3});
base(i) = str2num(R{4});
units{i} = R{5};
end
else
for i = 1:size(val, 1)
[row(i), signal(i), gain(i), base(i), units(i)]=strread(fgetl(fid),'%d%s%f%f%s','delimiter','\t');
end
end
fclose(fid);
val(val==-32768) = NaN;
for i = 1:size(val, 1)
val(i, :) = (val(i, :) - base(i)) / gain(i);
end
x = (1:size(val, 2)) * interval;
plot(x', val');
for i = 1:length(signal)
labels{i} = strcat(signal{i}, ' (', units{i}, ')');
end
legend(labels);
xlabel('Time (sec)');
% grid on
end
if i run this program error came that is given below
??? Undefined function or variable 'Name'.
Error in ==> plotATM at 4
infoName = strcat(Name, '.info');
what should i do.?

Answers (1)

sarika
sarika on 28 Nov 2014
plotATM is a just a function to plot the ECG signal..This code doesn't remove any kind of noises.
As plotATM is a function you can't run it directly. You have to call in some other script like
clc, clear all,close all;
plotATM(100m);
where 100m is a .mat ECG signal from MIT-BIH Arrhythmia database
Here u have to select database and in toolbox window u have select "Export signal as .mat"
If u choose ECG 100 ...then 100m is a .mat file u get , download and save it in your current directory
Now you can plot ECG 100 signal.

Categories

Find more on Simulation, Tuning, and Visualization in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!