forked from ldominguezruben/ASET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathASET_ExportXlsFile.m
203 lines (182 loc) · 9.36 KB
/
ASET_ExportXlsFile.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
196
197
198
199
200
201
function ASET_ExportXlsFile(vars)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This function creates the EXCEL Files and export the file.
%
% by Dominguez Ruben, L. FICH-UNL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Read data
guiparams = getappdata(0,'guiparams');%Calculated data
ADCP=getappdata(0,'ADCPdata');%Parameters data
for t=1:size(guiparams,2)%check number of files
%Read data of calculate
if iscell(guiparams)%multi select
V = guiparams{t}.V;
S = guiparams{t}.S;
Css = guiparams{t}.Css;
Meas = guiparams{t}.Meas;
NoMeas = guiparams{t}.NoMeas;
Array = guiparams{t}.Array;
QEdge = guiparams{t}.QEdge;
Dis = guiparams{t}.Dis;
VelExtraM = guiparams{t}.VelExtraM;
CssExtraM = guiparams{t}.CssExtraM;
FileName = guiparams{t}.FileName;
FileNamePD0 = guiparams{t}.FileNamePD0;
else
V = guiparams.V;
S = guiparams.S;
Css = guiparams.Css;
Meas = guiparams.Meas;
NoMeas = guiparams.NoMeas;
Array = guiparams.Array;
QEdge = guiparams.QEdge;
Dis = guiparams.Dis;
VelExtraM = guiparams.VelExtraM;
CssExtraM = guiparams.CssExtraM;
FileName = guiparams.FileName;
FileNamePD0 = guiparams.FileNamePD0;
end
message=['Save Excel file of ' FileName];
[file,path] = uiputfile('*.xlsx',message);
if file==0
break
else
outfile = fullfile(path,file);
waitmessage=['Exporting Excel File...' file];
hwait = waitbar(0,waitmessage,'Name','ASET');
if vars.units==0 %metric system
%Create the first sheet
data1 = {...
'ASET: Summary of Data Analysis' '' '' '' '' '';...
'Date Processed: ' datestr(now) '' '' '' '';...
'' '' '' '' '' '';...
'Cross Section Data' '' '' '' '' '';...
'Name File:' '' '' '' '' FileName ;...
'PD0 Name File:' '' '' '' '' FileNamePD0;...
'Distance cross section [m]:' '' '' '' '' round(V.mcsDist(1,end),2);...
'Average Depth [m]:' '' '' '' '' round(nanmean(Array.Bed),2);...
'' '' '' '' '' '';...
'ASET: Hydraulics Variables' '' '' '' '' '';...
'Average Velocity [cm/s]:' '' '' '' '' round(nanmean(nanmean(Array.uMag)),2);...
'Velocity Extrapolation Method:' '' '' '' '' VelExtraM;...
'Total Liquid Discharge [m3/s]:' '' '' '' '' round(Dis.Total+QEdge.Q.left+QEdge.Q.right,2);...
'Surface Liquid Discharge [m3/s]:' '' '' '' '' round(Dis.surfT,2);...
'Measured Liquid Discharge [m3/s]:' '' '' '' '' round(Dis.Meas,2);...
'Bottom Liquid Discharge [m3/s]:' '' '' '' '' round(Dis.bottomT,2);...
'Left Liquid Discharge [m3/s]:' '' '' '' '' round(QEdge.Q.left,2);...
'Right Liquid Discharge [m3/s]:' '' '' '' '' round(QEdge.Q.right,2);...
'' '' '' '' '' '';...
'ASET: Sedimentology Variables' '' '' '' '' '';...
'Ms1 Concentration [mg/l]:' '' '' '' '' round(S.Csf);...
'Qw Total [kg/s]:' '' '' '' '' round(Array.GwT);...
'Average Ms2 Concentration [mg/l]:' '' '' '' '' round(nanmean(nanmean(Array.Css))*1000,2);...
'Ms2 Extrapolation Method:' '' '' '' '' CssExtraM;...
'Qss Total [kg/s]:' '' '' '' '' round(Array.GssT,2);...
'Surface Qss [kg/s]:' '' '' '' '' round(NoMeas.Surf.GssT,2);...
'Measured Qss [kg/s]:' '' '' '' '' round(Meas.GssT,2);...
'Bottom Qss [kg/s]:' '' '' '' '' round(NoMeas.Bottom.GssT,2);...
'Left Qss [kg/s]:' '' '' '' '' round(QEdge.Gss.left,2);...
'Right Qss [kg/s]:' '' '' '' '' round(QEdge.Gss.right,2);...
'' '' '' '' '' '';...
'ADCP Configuration and Calibration Data' '' '' '' '' '';
'ADCP model:' '' '' '' '' ADCP.typeADCP;...
'ADCP Frequency [kHz]:' '' '' '' '' ADCP.Inst.freq;...
'ADCP Cr coef:' '' '' '' '' ADCP.ccoef;...
'ADCP RSSI Slope Beam 1:' '' '' '' '' ADCP.rssi_beam1;...
'ADCP RSSI Slope Beam 2:' '' '' '' '' ADCP.rssi_beam2;...
'ADCP RSSI Slope Beam 3:' '' '' '' '' ADCP.rssi_beam3;...
'ADCP RSSI Slope Beam 4:' '' '' '' '' ADCP.rssi_beam4;...
'Draft [m]:' '' '' '' '' round(ADCP.R.draft,2);...
'kcEr Calibration' '' '' '' '' round(ADCP.kcEr,2);...
'' '' '' '' '' ''};
elseif vars.units==1 %English system
%Create the first sheet
data1 = {...
'ASET: Summary of Data Analysis' '' '' '' '' '';...
'Date Processed: ' datestr(now) '' '' '' '';...
'' '' '' '' '' '';...
'Cross Section Data' '' '' '' '' '';...
'Name File:' '' '' '' '' FileName ;...
'PD0 Name File:' '' '' '' '' FileNamePD0;...
'Distance cross section [ft]:' '' '' '' '' round(V.mcsDist(1,end),2);...
'Average Depth [ft]:' '' '' '' '' round(nanmean(Array.Bed),2);...
'' '' '' '' '' '';...
'ASET: Hydraulics Variables' '' '' '' '' '';...
'Average Velocity [ft/s]:' '' '' '' '' round(nanmean(nanmean(Array.uMag)),2);...
'Velocity Extrapolation Method:' '' '' '' '' VelExtraM;...
'Total Liquid Discharge [ft3/s]:' '' '' '' '' round(Dis.Total+QEdge.Q.left+QEdge.Q.right,2);...
'Surface Liquid Discharge [ft3/s]:' '' '' '' '' round(Dis.surfT,2);...
'Measured Liquid Discharge [ft3/s]:' '' '' '' '' round(Dis.Meas,2);...
'Bottom Liquid Discharge [ft3/s]:' '' '' '' '' round(Dis.bottomT,2);...
'Left Liquid Discharge [ft3/s]:' '' '' '' '' round(QEdge.Q.left,2);...
'Right Liquid Discharge [ft3/s]:' '' '' '' '' round(QEdge.Q.right,2);...
'' '' '' '' '' '';...
'ASET: Sedimentology Variables' '' '' '' '' '';...
'Ms1 Concentration [t/l]:' '' '' '' '' round(S.Csf);...
'Qw Total [t/s]:' '' '' '' '' round(Array.GwT);...
'Average Ms2 Concentration [t/l]:' '' '' '' '' round(nanmean(nanmean(Css))*1000,2);...
'Ms2 Extrapolation Method:' '' '' '' '' CssExtraM;...
'Gss Total [t/s]:' '' '' '' '' round(Array.GssT,2);...
'Surface Qss [t/s]:' '' '' '' '' round(NoMeas.Surf.GssT,2);...
'Measured Qss [t/s]:' '' '' '' '' round(Meas.GssT,2);...
'Bottom Qss [t/s]:' '' '' '' '' round(NoMeas.Bottom.GssT,2);...
'Left Qss [t/s]:' '' '' '' '' round(QEdge.Gss.left,2);...
'Right Qss [t/s]:' '' '' '' '' round(QEdge.Gss.right,2);...
'' '' '' '' '' '';...
'ADCP Configuration and Calibration Data' '' '' '' '' '';
'ADCP model:' '' '' '' '' ADCP.typeADCP;...
'ADCP Frequency [kHz]:' '' '' '' '' ADCP.Inst.freq;...
'ADCP C coef:' '' '' '' '' ADCP.ccoef;...
'ADCP RSSI Slope Beam 1:' '' '' '' '' ADCP.rssi_beam1;...
'ADCP RSSI Slope Beam 2:' '' '' '' '' ADCP.rssi_beam2;...
'ADCP RSSI Slope Beam 3:' '' '' '' '' ADCP.rssi_beam3;...
'ADCP RSSI Slope Beam 4:' '' '' '' '' ADCP.rssi_beam4;...
'Draft [ft]:' '' '' '' '' round(ADCP.R.draft,2);...
'kcEr Calibration' '' '' '' '' round(ADCP.kcEr,2);...
'' '' '' '' '' ''};
end
xlswrite(outfile,data1,'ASET Summary','A1');
waitbar(1/5,hwait)
for j=1:size(Array.Depth_uMag,2)
Distmody(1:size(Array.Depth_uMag,1),j) = Array.Dist(1,j);
Bedmody(1:size(Array.Depth_uMag,1),j) = Array.Bed(1,j);
end
%Create the second sheet
headers2 = {...
'Depth of Velocity Magnitude in m'...
'Velocity Magnitude in cm/s'...
'Depth of Concentration in m'...
'Concentration Ms2 in kg/m3'...
'Depth of Qss in m'...
'Qss in Kg/s'...
'Distance in m'...
'Bed Elevation in m'...
};
data2 = [...
Array.Depth_uMag(:)...
Array.uMag(:)...
Array.Depth_Css(:)...
Array.Css(:)...
Array.Depth_Gss(:)...
Array.Gss(:)...
Distmody(:)...
Bedmody(:)...
];
waitbar(0.4,hwait)
data2(isnan(data2)) = -9999;
data2(data2==0)=-9999;
waitbar(0.75,hwait)
pvout2 = vertcat(headers2,num2cell(data2));
xlswrite(outfile,pvout2, 'ASET Results');
waitbar(1,hwait)
delete(hwait)
clear Css V Array Meas QEdge Dis VelExtraM CssExtraM S NoMeas Distmody Bedmody
% Push messages to Log Window:
% ----------------------------
log_text = {...
'';...
['%--- ' datestr(now) ' ---%'];...
'Complete Export Excel File'; outfile};
statusLogging(vars.LogWindow, log_text)
end
end