-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcsv_normalcAP.m
58 lines (47 loc) · 1.51 KB
/
csv_normalcAP.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
58
function [traceAnalysis] = csv_normalcAP (allData)
%%normalization and plotting of worked up cardiac data
%%load the data
cAPtrace = allData;
%%rename and define variables
A = cAPtrace;
numEvents = length(A);
normalcAP = A ;%load relevant cAP
minimum = min(A);
maximum = max(A);
difference = maximum-minimum;
normcAP = (normalcAP-minimum)./difference;
% % plot normalized cAPs
% figure('name',outputName,'numbertitle','off');
% hold on
% title('AP Events');
% xlabel('Time(ms)');
% ylabel('Intensity');
% for i= 1:numEvents;
% numFrames = length(normcAP{i,1});
% for j= 1:numFrames;
% numframes2 = length (normcAP{j,1});
% timeElap2 = numframes2*(1/Fs);
% time2 = zeros (numframes2,1); %pre-allocate;
% cnt = 1; %start the count;
% for ii = (1:numframes2)
% time2(cnt) = (ii/Fs);
% cnt = cnt + 1;
% end
% time2 = time2*1000;
% plot (time2 , normcAP{i,1});
% end
%calculate and plot avg normalized cAP
% n = max(cellfun(@(x) size(x,1),normcAP));
% fillcAP_Data = cellfun(@(x) [x;zeros(n-size(x,1),1)],normcAP,'un',0);
% meancAP = mean(cat(3,fillcAP_Data{:}),3);
% plot(meancAP,'LineWidth',3);
%%save variables and traces before exit
% fullOutputName = [outputPath outputName];
% save(fullOutputName,'normcAP','-append');
% save(fullOutputName,'meancAP','-append');
%Save figure
% saveas(gcf,fullOutputName,'pdf'); %save as a pdf
% saveas(gcf,fullOutputName); %save as matlab fig
%define output
traceAnalysis = normcAP;
end