-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmax_min_auto.m
34 lines (33 loc) · 1.25 KB
/
max_min_auto.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
function max_min_auto()
folders = dir("/Users/nayanayeshlur/Downloads/New_Healthy_Representative_Displacement_Condensed_STDEV/");
max_min = zeros(2, 1);
for i = 1:length(folders)
folder = folders(i).name;
if folder ~= "." & folder ~= ".." & folder ~= ".DS_Store"
fullName = strcat("/Users/nayanayeshlur/Downloads/New_Healthy_Representative_Displacement_Condensed_STDEV/",folder);
max_min_vec = readFileswithinFolder(fullName);
max_min = [max_min max_min_vec];
end
end
max_min(:, 1) = [];
save("Max_Min_Vector_H.mat", "max_min");
end
function max_min = readFileswithinFolder(folderName)
Files = dir(folderName);
max_min = zeros(2, 4);
max_min_index = 1;
for j=1:length(Files)
FileNames = Files(j).name;
[~, fName, fExt] = fileparts(FileNames);
if fExt == ".mat"
FileNames = strcat(strcat(folderName,"/"),strcat(FileNames,"/"));
disp(FileNames);
load(FileNames, "single_cycle");
[~, idx] = max(single_cycle);
max_min(1, max_min_index) = idx;
[~, idx] = min(single_cycle);
max_min(2, max_min_index) = idx;
max_min_index = max_min_index + 1;
end
end
end