-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathhp2diam.m
195 lines (173 loc) · 5.46 KB
/
hp2diam.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Script: hp2diam.m
% Path: C:\Diamond or C:\Scripts
% Purpose: To convert the hp translated matlab files into Diamond
% format.
% Input: 6 Files: coherence.mat crosspow.mat freqresp.mat
% inputpow.mat insttime.mat outputpo.mat
% Output: Diamond compatible file *_data.mat (8 char basename)
% Author: Erik Gregory Straser (modified by S. W. Doebling)
% Version: 1.6
% Date: August 6, 1996 (modified June 6, 1998)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
[null, path] = uigetfile('*.mat', 'Choose a file in the new directory');
eval(['cd ', path]);
[dest_file, dest_path] = uigetfile('*.mat', 'Destination file:');
temp = input('Enter the reference DOF Number: (Default = 32) ');
if isempty(temp)
refDOF(1,1) = 32;
else
refDOF(:,1) = temp;
end
temp = input('Enter the direction of the reference channel: (X=1,Y=2,Z=3 Default=3) ');
if isempty(temp)
refDOF(1,2) = 3;
else
refDOF(:,2) = temp;
end
max_channel = input('Enter the maximum channel number: (Default = 32) ');
if isempty(max_channel)
max_channel = 32;
end
%Making G Matrix
load freqresp.mat
nlines = size (eval(['o1i',int2str(refDOF(1,1))]),1);
x0 = eval(['o1i',int2str(refDOF(1,1)),'x0']);
xi = eval(['o1i',int2str(refDOF(1,1)),'xi']);
sp = xi*(nlines-1);
cf = (x0 + sp)/2;
domain = 'Frequency Domain';
index = 1;
respDOF = zeros(max_channel - size(refDOF,1),1);
G = zeros(nlines * (max_channel - size(refDOF,1)),1);
for i = 1:max_channel
if i ~= refDOF(1,1)
file_index = ['o',int2str(i),'i',int2str(refDOF(1,1))];
filename = [file_index];
if exist (filename)
G( (index-1)*nlines+1 : index*nlines,1) = eval([filename]);
respDOF(index,1) = i;
respDOF(index,2) = 3;
index = index + 1;
eval(['clear ' filename]);
eval(['clear ', filename,'x0']);
eval(['clear ', filename,'xi']);
eval(['clear ', filename,'xl']);
DATA_STORE.G(:,index,1,:) = G((index-1)*nlines+1 : index*nlines,1,:);
end
end
end
%Making Coh Matrix
if exist('coherenc.mat') == 2,
load coherenc.mat
index = 1;
Coh = zeros(nlines*(max_channel - size(refDOF,1)),1);
for i = 1:max_channel
if i ~= refDOF(1,1)
file_index = ['o',int2str(i),'i',int2str(refDOF(1,1))];
filename = [file_index];
if exist (filename)
Coh((index-1)*nlines+1 : index*nlines,1) = eval([filename]);
index = index + 1;
eval(['clear ' filename]);
eval(['clear ', filename,'x0']);
eval(['clear ', filename,'xi']);
eval(['clear ', filename,'xl']);
DATA_STORE.Coh(:,index,1,:) = Coh((index-1)*nlines+1 : index*nlines,1,:);
end
end
end
end
%Making Gxy Matrix
load crosspow.mat
index = 1;
Gxy = zeros(nlines*(max_channel - size(refDOF,1)),1);
for i = 1:max_channel
if i ~= refDOF(1,1)
file_index = ['o',int2str(i),'i',int2str(refDOF(1,1))];
filename = [file_index];
if exist (filename)
Gxy((index-1)*nlines+1 : index*nlines,1) = eval([filename]);
index = index + 1;
eval(['clear ' filename]);
eval(['clear ', filename,'x0']);
eval(['clear ', filename,'xi']);
eval(['clear ', filename,'xl']);
DATA_STORE.Gxy(:,index,1,:) = Gxy((index-1)*nlines+1 : index*nlines,1,:);
end
end
end
%Making Gxx Matrix
load inputpow.mat
Gxx = zeros(nlines*size(refDOF,1),1);
index = 1;
for i = 1:max_channel
file_index = ['c',int2str(i)];
filename = [file_index];
if exist (filename)
Gxx((index-1)*nlines+1 : index*nlines,1) = eval([filename]);
index = index + 1;
eval(['clear ' filename]);
eval(['clear ', filename,'x0']);
eval(['clear ', filename,'xi']);
eval(['clear ', filename,'xl']);
DATA_STORE.Gxx(:,1,:) = Gxx(:,1,:);
end
end
% Making Gyy Matrix
load outputpo.mat
Gyy = zeros(nlines*(max_channel - size(refDOF,1)),1);
index = 1;
for i = 1:max_channel
if i ~= refDOF(1,1)
file_index = ['c',int2str(i)];
filename = [file_index];
if exist (filename)
Gyy((index-1)*nlines+1 : index*nlines,1) = eval([filename]);
index = index + 1;
eval(['clear ' filename]);
eval(['clear ', filename,'x0']);
eval(['clear ', filename,'xi']);
eval(['clear ', filename,'xl']);
DATA_STORE.Gyy(:,index,:) = Gyy((index-1)*nlines+1 : index*nlines,:);
end
end
end
%Making thist Matrix
load insttime.mat
t0 = c1x0;
t1 = c1x0 + (c1xi*size(c1,1));
thist = zeros(size(c1,1),max_channel - size(refDOF,1));
index = 1;
for i = 1:max_channel
file_index = ['c',int2str(i)];
filename = [file_index];
if exist (filename)
thist(:,index) = eval([filename]);
index = index + 1;
eval(['clear ' filename]);
eval(['clear ', filename,'x0']);
eval(['clear ', filename,'xi']);
eval(['clear ', filename,'xl']);
DATA_STORE.thist(:,index) = thist(:,index);
end
end
% Other DIAMOND Variables
DATA_STORE.navg = navg;
DATA_STORE.cf = cf;
DATA_STORE.nlines = nlines;
DATA_STORE.sp = sp;
DATA_STORE.test_type = test_type;
DATA_STORE.domain = domain;
DATA_STORE.refDOF = refDOF;
DATA_STORE.respDOF = respDOF;
DATA_STORE.t0 = t0;
DATA_STORE.t1 = t1;
% Save the file with the correct Diamond variables
eval(['save ',this_path,this_file,' DATA_STORE']);
fprintf(1,'\n*** Diamond compatible data is in %s%s.mat ***\n\n',this_path,this_file);
clear;
return;