-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreprocess_data.m
57 lines (38 loc) · 1.25 KB
/
preprocess_data.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
% preprocess features
clear; clc; close all;
% run this code for every feature mat file below
% im_pro-based features
% name = 'Left_Cold_1_9_3_4_Jul2020.mat';
% name = 'Left_Warm_1_9_3_4_Jul2020.mat';
% name = 'Right_Cold_1_9_3_4_Jul2020.mat';
% name = 'Right_Warm_1_9_3_4_Jul2020.mat';
% im_pro + DL-based features
% name = 'Left_Cold_1_9_3_4_DL_Aug2020.mat';
% name = 'Left_Warm_1_9_3_4_DL_Oct2020.mat';
% name = 'Right_Cold_1_9_3_4_DL_Aug2020.mat';
name = 'Right_Warm_1_9_3_4_DL_Oct2020.mat';
load(name);
f_values = Features.Feat_values;
ch_size = Features.checkerSize;
len = size(f_values,1);
if contains(name,'_DL_')
load('new_norm.mat')
else
load('norm_mat.mat')
end
nf_values = abs(f_values)./norm_mat;
ch_size = ch_size(1:len,:);
A_ch = ((ch_size(:,1).*ch_size(:,2)))/(34*34);
Nan = find(isnan(A_ch));
A_ch(Nan) = (31*31)/(34*34);
% divide all variables with A_ch
F_values = nf_values./A_ch;
Data.Raw = F_values;
Data.Mean = Mean_normalize(F_values);
Data.Range = Range_normalize(F_values);
Data.Max = Max_normalize(F_values);
Data.SNV = SNV(F_values);
Data.SG1 = Savitzky_Golay_1st(F_values);
Features.Data = Data;
Features.Sample_number = size(F_values,1);
save(['New_',name],'Features')