%************************************************************************** % James Lamberg 10May05 % EE 5821 Biomedical Modeling % Imports a .txt file created using rdsamp -p (or rdsamp-O-Matic) % Plots the first two signals (columns 2 and 3 of the .txt file) % Outputs a .MAT matrix containing the first two signals. % The matrix can then be used in the Wavelets toolbox %************************************************************************** clc; clear all; close all; %************************************************************************** % Get Data & User Inputs %************************************************************************** File_Name = input('ECG Data File Name = ','s'); % ECG Text File ECG_Data = load(File_Name); % Load The Text File Time = ECG_Data(:,1); % First Column Of File % If the input does not contain exactly two signals, modify the next two lines % and later references to ECG_1 and ECG_2 accordingly. ECG_1 = ECG_Data(:,2); % Second Column Of File ECG_2 = ECG_Data(:,3); % Third Column Of File Time_Adjusted = Time; % Time In Seconds Already %************************************************************************** % Plot Data %************************************************************************** plot(Time_Adjusted,ECG_1,'b'); hold on; plot(Time_Adjusted,ECG_2,'r'); %************************************************************************** % Fix Axes & Label %************************************************************************** Axis_X_Min = Time_Adjusted(1); Axis_X_Max = Time_Adjusted(length(Time_Adjusted)); Axis_Y = ylim; Axis_Y_Min = Axis_Y(1); Axis_Y_Max = Axis_Y(2); axis([Axis_X_Min Axis_X_Max Axis_Y_Min Axis_Y_Max]); Plot_Title = strcat('ECG Data From: ', File_Name); Plot_Title = regexprep(Plot_Title, '_', '-'); title(Plot_Title); xlabel('Time In Seconds (s)'); ylabel('ECG Amplitude In MilliVolts (mV)'); %************************************************************************** % Output Data File Into Current Working Directory %************************************************************************** File_Name = regexprep(File_Name, '.txt', ''); Axis_X_Min = num2str(round(Axis_X_Min)); save(strcat(File_Name,'_',Axis_X_Min) ... ,'ECG_1' , 'ECG_2', 'Time_Adjusted'); %************************************************************************** % End Of Code %**************************************************************************