Switch to unified view

a b/data preprocessing_Matlab/download_MITBIHDB.m
1
2
% create mitbih datasets: download all records and convert the records into .info,.mat and .txt(for annotations)
3
% before doing it, you have to install the open-source WFDB Software Package available at
4
% http://physionet.org/physiotools/wfdb.shtml 
5
6
% download the whole database but files have .dat and .atr extentions
7
% rc=physionetdb('mitdb',1); 
8
9
% input
10
% output .info, .hea, .mat and.txt files 
11
12
record_list = physionetdb('mitdb');
13
14
15
path_to_exes = 'path_to_WFDB_Toolbox\mcode\nativelibs\windows\bin';
16
path_to_save_records = 'path_to_downloaded_database';
17
18
% path_to_exes = 'C:\my_files\ECG_research\mcode\nativelibs\windows\bin';
19
% path_to_save_records = 'C:\my_files\ECG_dataset\MIT-BIH\mitbihdb';
20
21
mkdir(path_to_save_records);
22
cd(path_to_save_records);
23
tic
24
for i=1:length(record_list)
25
    
26
    command_annot = char(strcat(path_to_exes, filesep, 'rdann.exe -r mitdb/', record_list(i), ' -a atr -v >', record_list(i), 'm.txt'));
27
    system (command_annot);
28
    command_mat_info_ = char(strcat(path_to_exes, filesep, 'wfdb2mat.exe -r mitdb/', record_list(i), ' >', record_list(i), 'm.info'));
29
    system (command_mat_info_);
30
    
31
%     system('C:\my_files\ECG_research\mcode\nativelibs\windows\bin\wfdb2mat.exe -r 100s -f 0 -t 10 >100sm.info')
32
%     system('C:\my_files\ECG_research\mcode\nativelibs\windows\bin\rdann.exe -r mitdb/100 -a atr >100.txt')
33
    
34
end
35
toc
36
disp('Successfully generated :)')
37