forked from Severson-Group/eMach-matlab
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsortMapdataPyleecanMat.m
More file actions
33 lines (32 loc) · 1.18 KB
/
Copy pathsortMapdataPyleecanMat.m
File metadata and controls
33 lines (32 loc) · 1.18 KB
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
function [EMMapStruct,forceMapStruct] = sortMapdataPyleecanMat(EMMapStruct, forceMapStruct)
%% EMmap Sorting
% EMFileName에서 "case"와 ".mat" 사이의 숫자 추출
for i = 1:length(EMMapStruct)
EMFileName = EMMapStruct(i).EMFileName;
expression = 'case(\d+)\.mat';
match = regexp(EMFileName, expression, 'tokens');
if ~isempty(match)
caseNumber = str2double(match{1}{1});
EMMapStruct(i).caseNumber = caseNumber;
end
end
% sorting
[~,index] = sortrows([EMMapStruct.caseNumber].');
EMMapStruct = EMMapStruct(index);
clear index
%% Forcemap Sorting
% forceFileName에서 "case"와 "force.mat" 사이의 숫자 추출
for i = 1:length(forceMapStruct)
forceFileName = forceMapStruct(i).forceFileName;
expression = 'case(\d+)force\.mat';
match = regexp(forceFileName, expression, 'tokens');
if ~isempty(match)
caseNumber = str2double(match{1}{1});
forceMapStruct(i).caseNumber = caseNumber;
end
end
% sorting
[~,index] = sortrows([forceMapStruct.caseNumber].');
forceMapStruct = forceMapStruct(index);
clear index
end