-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilePacketProcess.m
More file actions
25 lines (24 loc) · 916 Bytes
/
Copy pathfilePacketProcess.m
File metadata and controls
25 lines (24 loc) · 916 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
source = fullfile(pwd, 'In'); %Datasets folder
%Get files from all datasets.
files = dir(fullfile(source, 'MPZ', '*', '*', '*.mat')); %'MPZ dataset'
files = dir(fullfile(source, '*', '*.mat'));
addPathes()
for ai = 1:numel(files)
fullName = fullfile(files(ai).folder, files(ai).name);
load(fullName, 'myFile');
%Get phase data for the current file and update structure.
myFile = processFileStruct(myFile);
%Get conditions if they are - check the current datatset folder.
dtstRoot = strsplit(strrep(files(ai).folder, source, ''), filesep);
dtstRoot = fullfile(source, dtstRoot{2});
if exist(fullfile(dtstRoot, 'conditions.m'), 'file')
currentFolder = pwd;
cd(dtstRoot)
myFile.conditions = conditions(fullName);
cd(currentFolder);
else
myFile.conditions = [];
end
%Update structure on disk.
save(fullName, 'myFile', '-v7.3');
end