-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgendrift2.m
63 lines (45 loc) · 1.16 KB
/
gendrift2.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
59
60
61
62
63
function [driftgr,driftgrindx,driftgrnodes,driftgrz] =...
gendrift2(driftcodes, driftcodetype, driftdesc, driftnodes, nodecoord)
ndriftcodes = length(driftcodes);
for j = 1:ndriftcodes
dc = driftcodes{j};
dct = driftcodetype(j);
dd = driftdesc;
[aa,bb] = gendrift(dc, dd, dct);
driftgr{j} = aa;
driftgrindx{j} = bb;
snode = driftnodes(bb,2);
enode = driftnodes(bb,1);
sz = nodecoord(snode, 3);
ez = nodecoord(enode, 3);
driftgrnodes{j} = [snode, enode];
driftgrz{j} = [sz, ez];
end
end
function [driftgrdesc, driftgrindx] = gendrift(cod, ddes,typ)
% Type = 1 : AC1, AC2 ....
% Type = 2 : AC01, AC02 ....
% Type = 3 : AC_1, AC_2 ....
% Type = 4 : AC_01, AC_02 ....
nchar = length(ddes{1});
dfmt{1} = '%u';
dfmt{2} = '%02u';
dfmt{3} = '_%u';
dfmt{4} = '_%02u';
dmftt = dfmt{typ};
for i = 1:100
tdd = [cod, num2str(i, dmftt)];
ntdd = length(tdd);
nspace = nchar - ntdd;
for j=1:nspace;
tdd = [tdd, ' '];
end
dri = find(strcmp(ddes, tdd));
if dri == 0
break;
elseif dri ~= 0
driftgrdesc{i,1} = tdd;
driftgrindx(i,1) = dri;
end
end
end