


loadFromFile - Loads the ECG signal from the full APEX recording file
Input:
filePath can be absolute or relative to working directory
Outputs:
sig is the raw ECG signal
fs is the sampling
Example:
[sig, fs] = loadFromFile('a2ecg');
Process:
1. The signal is first formatted in a row vector.
2. The first minute of the signal is processed using our full
pipeline. If necessary, the signal is reversed (see invertIfNeeded).

0001 function [ sig, fs ] = loadFromFile( file ) 0002 %loadFromFile - Loads the ECG signal from the full APEX recording file 0003 % Input: 0004 % filePath can be absolute or relative to working directory 0005 % Outputs: 0006 % sig is the raw ECG signal 0007 % fs is the sampling 0008 % 0009 % Example: 0010 % [sig, fs] = loadFromFile('a2ecg'); 0011 % 0012 % Process: 0013 % 1. The signal is first formatted in a row vector. 0014 % 2. The first minute of the signal is processed using our full 0015 % pipeline. If necessary, the signal is reversed (see invertIfNeeded). 0016 % 0017 0018 load(file + ".mat"); 0019 0020 data = eval(file); 0021 0022 if(string(data.channels(1)) ~= 'ECG') 0023 print "Unexpected data format"; 0024 return; 0025 end 0026 % Get the first channel (ecg) 0027 sig = data.data(:,1); 0028 if(~isrow(sig)) 0029 sig = sig.'; 0030 end 0031 0032 fs = data.Fs; 0033 windowInSeconds = 60; 0034 %sig = invertIfNecessary( sig, fs, windowInSeconds); 0035 0036 0037 0038 0039 end 0040