-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyzeCardiacData.m
38 lines (34 loc) · 1.36 KB
/
analyzeCardiacData.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
function[] = analyzeCardiacData()
prompt2 = 'Provide filename: ';
%%select .mat files generated from apdCalc to combine and analyze
[Filelist,Pathname] = uigetfile('C:\Users\Steven Boggess\Documents\Miller Lab\Data\*.mat','File Selector','MultiSelect','on');
allData = struct();
numFiles = numel(Filelist);
for iFile = 1:numFiles % Loop over found files
Data = load(fullfile(Pathname, Filelist{1,iFile}));
Data = rmfield(Data , 'cAP_Data') ; %remove the table from files, avoid error
Fields = fieldnames(Data);
for iField = 1:numel(Fields) % Loop over fields of current file
aField = Fields{iField};
if isfield(allData, aField) % Attach new data:
allData.(aField)(end+1:end+numel(Data.(aField))) = Data.(aField); %Add new data to end of previous data
else
allData.(aField) = Data.(aField);
end
end
end
filename = input (prompt2);
if isempty(filename) == 1
disp ('Please provide a string');
filename = input(prompt2);
else
end
if ischar(filename) == 0
disp ('Please provide a character in single quotations');
filename = input(prompt2);
else
end
DataAnalysis = cAPstat (allData , filename, Pathname);
allcAPs = normalcAP (allData , filename, Pathname);
% save(fullfile(Folder, 'AllData.mat'), '-struct', 'allData');
end