loadShort

PURPOSE ^

LOADSHORT Cuts the desired input signal and leaves the proportion requested

SYNOPSIS ^

function [ sig, fs ] = loadShort( file, proportion )

DESCRIPTION ^

LOADSHORT Cuts the desired input signal and leaves the proportion requested
   Input:
       filePath can be absolute or relative to working directory
   Outputs:
       sig is the raw ECG signal
       fs is the sampling 

   Example:
       [sig, fs] = loadShort('infant1+ecg', 0.1);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ sig, fs ] = loadShort( file, proportion )
0002 %LOADSHORT Cuts the desired input signal and leaves the proportion requested
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] = loadShort('infant1+ecg', 0.1);
0011 %
0012 load(file + ".mat");
0013 data = eval(file);
0014 
0015 if(string(data.channels(1)) ~= 'ECG')
0016     print "Unexpected data format";
0017     return;
0018 end
0019 % Get the first channel (ecg)
0020 sig = data.data(:,1);
0021 if(~isrow(sig))
0022     sig = sig.';
0023 end
0024 
0025 totalSize = length(sig);
0026 newSize = floor(length(sig) * proportion);
0027 
0028 sig = sig(1:newSize);
0029 
0030 
0031 fs = data.Fs;
0032 windowInSeconds = 60;
0033 %sig = invertIfNecessary( sig, fs, windowInSeconds);
0034 
0035 
0036 
0037 
0038 end
0039

Generated on Thu 15-Mar-2018 13:53:54 by m2html © 2005