-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdata_format.m
More file actions
26 lines (22 loc) · 748 Bytes
/
data_format.m
File metadata and controls
26 lines (22 loc) · 748 Bytes
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
function [dataNorm] = data_format(filename,smooth_points)
%Get Data
fprintf('Loading %s => Smoothing with %d points\n', filename, smooth_points);
V = load(filename);
% convert from cells array to matrix
CHAN_N = length(V.data);
CHAN_L = length(V.data{1});
disp 'Format Data'
%Format Data In Correct Matrix Format
dataM = (reshape(cell2mat(V.data),CHAN_L,CHAN_N));
disp 'Smooth Data'
dataSmooth = dataM;
%Smooth Data
for i=1:CHAN_N
size(dataM(:,i))
smooth_points
dataSmooth(:,i) = smooth(dataM(:,i), smooth_points);
end
disp 'Normalize Data'
%Normalize - zero mean and 1 std
dataNorm = (dataSmooth - repmat(mean(dataSmooth),CHAN_L,1)) ./ repmat(std(dataSmooth),CHAN_L,1);
dataNorm = dataNorm'; %Put in format rest of program is expeting