-
Notifications
You must be signed in to change notification settings - Fork 10
/
MinPlot.m
507 lines (434 loc) · 22.9 KB
/
MinPlot.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
%%EPMA data processing script
clear all
close all
disp('The file must be a .txt file with oxide headings (see template)');
[FileName, PathName, FilterIndex] = uigetfile({'*.txt';'*.csv';'*.xls';'*.xlsx'},'File Selector');
T=readtable(strcat(PathName,FileName));
data=table2array(T); %data converted to array
data(isnan(data))=0;
headers=T.Properties.VariableNames; %saves a list of the oxides in the header
%call functions for data processing
prompt2='What mineral formula do you want to recalculate?:';
disp('Options are (CASE SENSITIVE): garnet, pyroxene, olivine, amphibole,')
disp('feldspar, mica, staurolite, cordierite, chlorite, chloritoid,')
disp('talc, epidote, titanite, oxyspinel, ilmenite, apatite, and sulfide.')
wantformula = input(prompt2, 's');
%garnet
if strcmp(wantformula, 'garnet')
prompt3='Calculate Fe3+ from stoichiometry? (y|n):'; %asks if you want the ferric iron calculation
wantferric=input(prompt3, 's');
%if you do not want ferric iron, the following procedure occurs
if strcmp(wantferric, 'y')
prompt4='Is the garnet grossular-andradite series? (y|n):';
wantgrsand=input(prompt4, 's');
if strcmp(wantgrsand, 'y')
%Fe3+ calculation for ugrandite garnets
prompt5='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt5, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=garnet_skarn(data,headers,wantstrctfrm); %calls garnet (w/Fe3+) calculation function, outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=garnet_skarn(data,headers,wantstrctfrm); %calls the garnet (w/Fe3+) calculation, but only outputs APFU and no endmembers
disp('The calculated APFU was output without cation assignment.')
end
else
%Fe3+ calculation for pyralspite garnets
prompt5='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt5, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=garnet_fe3(data,headers,wantstrctfrm); %calls garnet (w/Fe3+) calculation function, outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=garnet_fe3(data,headers,wantstrctfrm); %calls the garnet (w/Fe3+) calculation, but only outputs APFU and no endmembers
disp('The calculated APFU was output without cation assignment.')
end
end
else
%If an FeO only calculation was selected, the following procedure
%occurs
prompt4='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=garnet_fe2(data,headers,wantstrctfrm); %calls garnet (FeO only) calculation function, outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=garnet_fe2(data,headers,wantstrctfrm); %calls garnet (FeO only) calculation function, outputs the APFU only
disp('The calculated APFU was output without cation assignment.')
end
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%pyroxene
if strcmp(wantformula, 'pyroxene')
prompt3='Calculate Fe3+ from stoichiometry? (y|n):'; %asks if you want the ferric iron calculation
wantferric=input(prompt3, 's');
%if you do not want ferric iron, the following procedure occurs
if strcmp(wantferric, 'y')
prompt4='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
prompt5='Use the calculation scheme for high-pressure/temperature pyroxene? (y|n):';
disp('For K-, Ca-Eskola-, & Ca-Tschermaks-rich pyroxenes:')
wantHP=input(prompt5, 's');
if strcmp(wantHP, 'y')
StrctFrm=pyroxene_fe3_HP(data,headers,wantstrctfrm); %calls pyroxene (w/Fe3+) calculation function, outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
StrctFrm=pyroxene_fe3(data,headers,wantstrctfrm); %calls pyroxene (w/Fe3+) calculation function, outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
end
else
[~,APFU]=pyroxene_fe3(data,headers,wantstrctfrm); %calls the pyroxene (w/Fe3+) calculation, but only outputs APFU and no endmembers
disp('The calculated APFU was output without cation assignment.')
end
else
%If an FeO only calculation was selected, the following procedure
%occurs
prompt4='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=pyroxene_fe2(data,headers,wantstrctfrm); %calls pyroxene (FeO only) calculation function, outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=pyroxene_fe2(data,headers,wantstrctfrm); %calls pyroxene (FeO only) calculation function, outputs the APFU only
disp('The calculated APFU was output without cation assignment.')
end
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%olivine
if strcmp(wantformula, 'olivine')
prompt3='Calculate Fe3+ from stoichiometry? (y|n):'; %asks if you want the ferric iron calculation
wantferric=input(prompt3, 's');
%if you do not want ferric iron, the following procedure occurs
if strcmp(wantferric, 'y')
prompt4='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=olivine_fe3(data,headers,wantstrctfrm); %calls olivine (w/Fe3+) calculation function, outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=olivine_fe3(data,headers,wantstrctfrm); %calls the olivine (w/Fe3+) calculation, but only outputs APFU and no endmembers
disp('The calculated APFU was output without cation assignment.')
end
else
%If an FeO only calculation was selected, the following procedure
%occurs
prompt4='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=olivine_fe2(data,headers,wantstrctfrm); %calls olivine (FeO only) calculation function, outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=olivine_fe2(data,headers,wantstrctfrm); %calls olivine (FeO only) calculation function, outputs the APFU only
disp('The calculated APFU was output without cation assignment.')
end
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%feldspar
if strcmp(wantformula, 'feldspar')
StrctFrm=feldspar(data,headers); %calls feldspar calculation
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
end
end
%mica
if strcmp(wantformula, 'mica')
prompt4='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=mica(data,headers,wantstrctfrm); %outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=mica(data,headers,wantstrctfrm); %saves only APFU
disp('The calculated APFU was output without cation assignment.')
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%amphibole
if strcmp(wantformula, 'amphibole')
prompt3='Calculate Fe3+ from stoichiometry? (y|n):'; %asks if you want the ferric iron calculation
wantferric=input(prompt3, 's');
if strcmp(wantferric, 'y')
disp('Remember to closely check the 6 criteria for Fe3+ estimation.')
disp('Not applicable for some compositions, see appendices in')
disp('Leake et al. (1997) and Hawthorne et al. (2012).')
prompt4='Do you want to correct for OH=2-2Ti? (y|n):';
wantTiOH= input(prompt4, 's');
prompt5='Do you want cation assignment? (y|n):';
wantstrctfrm=input(prompt5, 's');
if strcmp(wantstrctfrm, 'y')
prompt6='Do you want to plot amphibole compositions? (y|n):';
wantplot= input(prompt6, 's');
[Strct_Frm, ~, ~, Fe3_limits, Fe3_class, ~, ~, ~, ~, ~, ~, ~]=amphibole(data,headers,wantstrctfrm,wantTiOH,wantplot,wantferric); %outputs the structural formula for the automated Fe3+ estimation only
disp('Mineral formula was output.')
%prompts you to save the output
prompt7='Do you wish to save the recalculated data? (y|n):';
save=input(prompt7,'s');
if strcmp(save,'y')
writetable(Strct_Frm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
writetable(Fe3_limits,strcat(PathName,FileName(1:size(FileName,2)-4),'_Fe3limits.txt'),'Delimiter','\t');
writetable(Fe3_class,strcat(PathName,FileName(1:size(FileName,2)-4),'_Fe3limitclassification.txt'),'Delimiter','\t');
end
else
wantplot='n';
[~, APFU, ~, Fe3_limits, Fe3_class, ~, ~, ~, ~, ~, ~, ~]=amphibole(data,headers,wantstrctfrm,wantTiOH,wantplot,wantferric); %outputs the AFPU only
disp('The calculated APFU was output without cation assignment.')
%prompts you to save the output
prompt7='Do you wish to save the recalculated data? (y|n):';
save=input(prompt7,'s');
if strcmp(save,'y')
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
writetable(Fe3_limits,strcat(PathName,FileName(1:size(FileName,2)-4),'_Fe3limits.txt'),'Delimiter','\t');
writetable(Fe3_class,strcat(PathName,FileName(1:size(FileName,2)-4),'_Fe3limitclassification.txt'),'Delimiter','\t');
end
end
else
wantplot='n';
wantstrctfrm='n';
prompt4='Do you want to correct for OH=2-2Ti? (y|n):';
wantTiOH= input(prompt4, 's');
[~, ~, APFU_FeT, ~, ~, ~, ~, ~, ~, ~, ~, ~]=amphibole(data,headers,wantstrctfrm,wantTiOH,wantplot,wantferric); %outputs the AFPU only
disp('The calculated FeO only APFU was output without cation assignment.')
%prompts you to save the output
prompt4='Do you wish to save the recalculated data? (y|n):';
save=input(prompt4,'s');
if strcmp(save,'y')
writetable(APFU_FeT,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%epidote
if strcmp(wantformula, 'epidote')
prompt4='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
[StrctFrm,~]=epidote(data,headers,wantstrctfrm); %calls epidote calculation
else
[~,APFU]=epidote(data,headers,wantstrctfrm); %calls epidote calculation
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%chlorite
if strcmp(wantformula, 'chlorite')
prompt4='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=chlorite(data,headers,wantstrctfrm); %outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=chlorite(data,headers,wantstrctfrm); %saves only APFU
disp('The calculated APFU was output without cation assignment.')
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%titanite
if strcmp(wantformula, 'titanite')
prompt4='Do you want cation assignment and endmember calculations? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=titanite(data,headers); %outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=titanite(data,headers); %saves only APFU
disp('The calculated APFU was output without cation assignment.')
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%talc
if strcmp(wantformula, 'talc')
prompt4='Do you want cation assignment? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
StrctFrm=talc(data,headers,wantstrctfrm); %outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=talc(data,headers,wantstrctfrm); %saves only APFU
disp('The calculated APFU was output without cation assignment.')
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%chloritoid
if strcmp(wantformula, 'chloritoid')
prompt4='Do you want cation assignment? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
[StrctFrm,~]=chloritoid(data,headers,wantstrctfrm); %outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=chloritoid(data,headers,wantstrctfrm); %saves only APFU
disp('The calculated APFU was output without cation assignment.')
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%staurolite
if strcmp(wantformula, 'staurolite')
APFU=staurolite(data,headers); %saves only APFU
disp('The calculated APFU was output without cation assignment.')
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
%spinel
if strcmp(wantformula, 'oxyspinel')
APFU=spinel_fe3(data,headers); %calls feldspar calculation
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
end
end
%cordierite
if strcmp(wantformula, 'cordierite')
prompt4='Do you want cation assignment? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
[StrctFrm,~]=cordierite(data,headers,wantstrctfrm); %outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=cordierite(data,headers,wantstrctfrm); %saves only APFU
disp('The calculated APFU was output without cation assignment.')
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end
%sulfide
if strcmp(wantformula,'sulfide')
APFU=sulfide(data,headers); %calls sulfide calculation
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
end
end
%ilmenite
if strcmp(wantformula, 'ilmenite')
APFU=ilmenite_fe3(data,headers); %calls ilmenite calculation
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
end
end
%apatite
if strcmp(wantformula, 'apatite')
prompt4='Do you want cation assignment? (y|n):';
wantstrctfrm=input(prompt4, 's');
if strcmp(wantstrctfrm, 'y')
[StrctFrm,~]=apatite(data,headers,wantstrctfrm); %outputs the structural formula with cation assignment
disp('Mineral formula and endmembers was output.')
else
[~,APFU]=apatite(data,headers,wantstrctfrm); %saves only APFU
disp('The calculated APFU was output without cation assignment.')
end
%prompts you to save the output
prompt5='Do you wish to save the recalculated data? (y|n):';
save=input(prompt5,'s');
if strcmp(save,'y')
if strcmp(wantstrctfrm, 'y') %if the structural formula option was chosen, a text file for the structural formula is saved
writetable(StrctFrm,strcat(PathName,FileName(1:size(FileName,2)-4),'_structuralformula.txt'),'Delimiter','\t');
else %if the APFU only was selected, then the APFU output is chosen
writetable(APFU,strcat(PathName,FileName(1:size(FileName,2)-4),'_APFU.txt'),'Delimiter','\t');
end
end
end