-
Notifications
You must be signed in to change notification settings - Fork 1
/
boolxrd.mlapp
626 lines (536 loc) · 28.2 KB
/
boolxrd.mlapp
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
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
classdef BoolXRD < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
AcademicModeMenu matlab.ui.container.Menu
TrainingModeMenu matlab.ui.container.Menu
GridLayout matlab.ui.container.GridLayout
LeftPanel matlab.ui.container.Panel
ImportRawXRDDataaswellCheckBox matlab.ui.control.CheckBox
PlaneOpacitySwitch matlab.ui.control.Switch
PlaneOpacitySwitchLabel matlab.ui.control.Label
LatticeSizecEditField matlab.ui.control.NumericEditField
LatticeSizecEditFieldLabel matlab.ui.control.Label
LatticeSizebEditField matlab.ui.control.NumericEditField
LatticeSizebEditFieldLabel matlab.ui.control.Label
LatticeSizeaEditField matlab.ui.control.NumericEditField
LatticeSizeaEditFieldLabel matlab.ui.control.Label
CrystalStructureDropDown matlab.ui.control.DropDown
CrystalStructureDropDownLabel matlab.ui.control.Label
AtomicSizeSlider matlab.ui.control.Slider
AtomicSizeSliderLabel matlab.ui.control.Label
UITable matlab.ui.control.Table
Image matlab.ui.control.Image
ReadPlotButton matlab.ui.control.StateButton
RightPanel matlab.ui.container.Panel
GridLayout2 matlab.ui.container.GridLayout
GridLayout3 matlab.ui.container.GridLayout
CommonMaterialsLabel matlab.ui.control.Label
Label matlab.ui.control.Label
SampleMaterialsListBox matlab.ui.control.ListBox
OpacitySlider matlab.ui.control.Slider
OpacitySliderLabel matlab.ui.control.Label
Image2 matlab.ui.control.Image
UIAxes matlab.ui.control.UIAxes
UIAxes2 matlab.ui.control.UIAxes
end
% Properties that correspond to apps with auto-reflow
properties (Access = private)
onePanelWidth = 576;
end
methods (Access = public)
function results = recaller(app, old, hklSending)
figure("Visible", "off");
if (old == true)
cla(app.UIAxes)
a_size = app.LatticeSizeaEditField.Value;
b_size = app.LatticeSizebEditField.Value;
c_size = app.LatticeSizecEditField.Value;
if (size(hklSending) == 0)
hkl = app.UITable.Data;
else
hkl = hklSending{:,:};
app.UITable.Data = hkl;
end
count = 0;
numDataSets = size(hkl, 1);
plotColors = jet(numDataSets);
for i = 1 : size(hkl, 1)
if hkl(i,1) == 0 || hkl(i,2) == 0 || hkl(i,3) == 0
hkl(hkl==0) = 0.00001;
end
P1 = [1 / hkl(i, 1), 0, 0];
P2 = [0, 1 / hkl(i, 2), 0];
P3 = [0, 0, 1 / hkl(i, 3)];
points=[P1' P2' P3']; % using the data given in the question
thisIndex = ceil(i);
thisColor = plotColors(thisIndex, :);
if app.PlaneOpacitySwitch.Value == "Slider"
opacity = app.OpacitySlider.Value / 100;
else
opacity = hkl(i,4) / 100;
end
fill3(app.UIAxes, a_size * points(1,:), b_size * points(2,:), c_size * points(3,:), thisColor, "FaceAlpha", opacity, "EdgeColor","black");
count = count + 1;
if count >= 1
hold(app.UIAxes, 'on');
end
box on;
xlabel(app.UIAxes,'X-Axis')
ylabel(app.UIAxes,'Y-Axis')
zlabel(app.UIAxes,'Z-Axis')
xlim(app.UIAxes,[0 a_size])
ylim(app.UIAxes,[0 b_size])
zlim(app.UIAxes,[0 c_size])
title(app.UIAxes, "XRD Planes and Crystal Structure")
lgd_data = app.UITable.Data;
lgd = legend(app.UIAxes, string(lgd_data(:, 1)) + string(lgd_data(:, 2)) + string(lgd_data(:, 3)));
title(lgd, "Miller Indices (hkl)")
end
if app.CrystalStructureDropDown.Value == "SC"
SC = [0, 0, 0; 0 0 1; 0 1 0; 0 1 1; 1 0 0; 1 0 1; 1 1 0; 1 1 1];
SC = SC .* [a_size b_size c_size];
scatter3(app.UIAxes,SC(:,1), SC(:,2), SC(:,3), app.AtomicSizeSlider.Value * 1000, "red", "filled", "MarkerFaceAlpha", 0.5);
elseif app.CrystalStructureDropDown.Value == "BCC"
BCC = [0,0,0; 0,0,1; 0,1,0; 1,0,0; 0,1,1; 1,1,0; 1,0,1; 1,1,1; 0.5, 0.5, 0.5];
BCC = BCC .* [a_size b_size c_size];
scatter3(app.UIAxes,BCC(:,1), BCC(:,2), BCC(:,3), app.AtomicSizeSlider.Value * 1000, "red", "filled", "MarkerFaceAlpha", 0.5);
elseif app.CrystalStructureDropDown.Value == "FCC"
FCC =[0,0,0; 0,0,1; 0,1,0; 1,0,0; 0,1,1; 1,1,0; 1,0,1; 1,1,1; 0.5, 0.5, 0; 0.5, 0, 0.5; 0, 0.5, 0.5; 0.5, 1, 0.5; 1, 0.5, 0.5; 0.5, 0.5, 1];
FCC = FCC .* [a_size b_size c_size];
scatter3(app.UIAxes,FCC(:,1), FCC(:,2), FCC(:,3), app.AtomicSizeSlider.Value * 1000, "red", "filled", "MarkerFaceAlpha", 0.5);
else
msgbox("You can also specify a crystal structure.", "Crystal Structure", "help")
end
hold(app.UIAxes, "off");
else
a_size = app.LatticeSizeaEditField.Value;
b_size = app.LatticeSizebEditField.Value;
c_size = app.LatticeSizecEditField.Value;
uiwait(msgbox("Please select your .xlsx file with the hkl values.", "[BoolXRD] Upload hkl File", "modal"));
[file, path] = uigetfile("*.xlsx");
hkl_file = strcat(path, file);
t = readmatrix(hkl_file);
app.UITable.Data = t;
if app.ImportRawXRDDataaswellCheckBox.Value == true
uiwait(msgbox("Please select your raw XRD Data with .xlsx extension.", "[BoolXRD] Upload Raw XRD Data", "modal"))
[file, path] = uigetfile("*.xlsx");
xrd_file = strcat(path, file);
xrd = readmatrix(xrd_file);
plot(app.UIAxes2, xrd(:,1), xrd(:,2));
hold(app.UIAxes2, "on");
title(app.UIAxes2, "XRD Data");
xlabel(app.UIAxes2, "Angle/2theta");
ylabel(app.UIAxes2, "Intensity");
end
hkl = app.UITable.Data;
count = 0;
numDataSets = size(hkl, 1);
plotColors = jet(numDataSets);
for i = 1 : size(hkl, 1)
if hkl(i,1) == 0 || hkl(i,2) == 0 || hkl(i,3) == 0
hkl(hkl==0) = 0.00001;
end
P1 = [1 / hkl(i, 1), 0, 0];
P2 = [0, 1 / hkl(i, 2), 0];
P3 = [0, 0, 1 / hkl(i, 3)];
points=[P1' P2' P3']; % using the data given in the question
thisIndex = ceil(i);
thisColor = plotColors(thisIndex, :);
if app.PlaneOpacitySwitch.Value == "Slider"
opacity = app.OpacitySlider.Value / 100;
else
opacity = hkl(i,4) / 100;
end
fill3(app.UIAxes, a_size * points(1,:), b_size * points(2,:), c_size * points(3,:), thisColor, "FaceAlpha", opacity, "EdgeColor","black");
count = count + 1;
if count >= 1
hold(app.UIAxes, 'on');
end
box on;
xlabel(app.UIAxes,'X-Axis')
ylabel(app.UIAxes,'Y-Axis')
zlabel(app.UIAxes,'Z-Axis')
xlim(app.UIAxes,[0 a_size])
ylim(app.UIAxes,[0 b_size])
zlim(app.UIAxes,[0 c_size])
title(app.UIAxes, "XRD Planes and Crystal Structure")
lgd_data = app.UITable.Data;
lgd = legend(app.UIAxes, string(lgd_data(:, 1)) + string(lgd_data(:, 2)) + string(lgd_data(:, 3)));
title(lgd, "Miller Indices (hkl)")
end
if app.CrystalStructureDropDown.Value == "SC"
SC = [0, 0, 0; 0 0 1; 0 1 0; 0 1 1; 1 0 0; 1 0 1; 1 1 0; 1 1 1];
SC = SC .* [a_size b_size c_size];
scatter3(app.UIAxes,SC(:,1), SC(:,2), SC(:,3), app.AtomicSizeSlider.Value * 1000, "red", "filled", "MarkerFaceAlpha", 0.5);
elseif app.CrystalStructureDropDown.Value == "BCC"
BCC = [0,0,0; 0,0,1; 0,1,0; 1,0,0; 0,1,1; 1,1,0; 1,0,1; 1,1,1; 0.5, 0.5, 0.5];
BCC = BCC .* [a_size b_size c_size];
scatter3(app.UIAxes,BCC(:,1), BCC(:,2), BCC(:,3), app.AtomicSizeSlider.Value * 1000, "red", "filled", "MarkerFaceAlpha", 0.5);
elseif app.CrystalStructureDropDown.Value == "FCC"
FCC =[0,0,0; 0,0,1; 0,1,0; 1,0,0; 0,1,1; 1,1,0; 1,0,1; 1,1,1; 0.5, 0.5, 0; 0.5, 0, 0.5; 0, 0.5, 0.5; 0.5, 1, 0.5; 1, 0.5, 0.5; 0.5, 0.5, 1];
FCC = FCC .* [a_size b_size c_size];
scatter3(app.UIAxes,FCC(:,1), FCC(:,2), FCC(:,3), app.AtomicSizeSlider.Value * 1000, "red", "filled", "MarkerFaceAlpha", 0.5);
else
msgbox("You can also specify a crystal structure.", "Crystal Structure", "help")
end
hold(app.UIAxes, "off");
end
end
function results = samplematerials(app, selection)
items = dictionary;
items("Platinium Nanoparticle (Pt)") = {[1 1 1 100; 2 0 0 100; 2 2 0 100; 3 1 1 100]};
items("Gold Nanoparticle (Au)") = {[1 1 1 100; 2 0 0 100; 2 2 0 100; 3 1 1 100]};
items("NaCl") = {[1 1 1 100 ; 2 0 0 45; 2 2 0 100; 3 1 1 100; 2 2 2 100; 4 0 0 100; 3 3 1 100; 4 2 0 100; 4 2 2 100]};
app.recaller(true, items(selection));
end
end
% Callbacks that handle component events
methods (Access = private)
% Value changing function: AtomicSizeSlider
function AtomicSizeSliderValueChanging(app, event)
changingValue = event.Value;
end
% Callback function
function UITableCellEdit(app, event)
indices = event.Indices;
newData = event.NewData;
situation = true;
app.recaller(situation, []);
end
% Value changed function: ReadPlotButton
function ReadPlotButtonValueChanged(app, event)
value = app.ReadPlotButton.Value;
situation = false;
app.recaller(situation, []);
end
% Value changed function: CrystalStructureDropDown
function CrystalStructureDropDownValueChanged(app, event)
value = app.CrystalStructureDropDown.Value;
situation = true;
app.recaller(situation, [])
end
% Value changed function: AtomicSizeSlider
function AtomicSizeSliderValueChanged(app, event)
value = app.AtomicSizeSlider.Value;
situation = true;
app.recaller(situation, []);
end
% Clicked callback: CrystalStructureDropDown
function CrystalStructureDropDownClicked(app, event)
item = event.InteractionInformation.Item;
end
% Value changed function: PlaneOpacitySwitch
function PlaneOpacitySwitchValueChanged(app, event)
value = app.PlaneOpacitySwitch.Value;
situation = true;
app.recaller(situation, []);
end
% Value changed function: OpacitySlider
function OpacitySliderValueChanged(app, event)
value = app.OpacitySlider.Value;
situation = true;
app.recaller(situation, []);
end
% Value changed function: LatticeSizeaEditField
function LatticeSizeaEditFieldValueChanged(app, event)
value = app.LatticeSizeaEditField.Value;
situation = true;
app.recaller(situation, []);
end
% Value changed function: LatticeSizebEditField
function LatticeSizebEditFieldValueChanged(app, event)
value = app.LatticeSizebEditField.Value;
situation = true;
app.recaller(situation, []);
end
% Value changed function: LatticeSizecEditField
function LatticeSizecEditFieldValueChanged(app, event)
value = app.LatticeSizecEditField.Value;
situation = true;
app.recaller(situation, []);
end
% Cell edit callback: UITable
function UITableCellEdit2(app, event)
indices = event.Indices;
newData = event.NewData;
situation = true;
app.recaller(situation, [])
end
% Menu selected function: AcademicModeMenu
function AcademicModeMenuSelected(app, event)
app.SampleMaterialsListBox.Visible=false; %Hides the Sample Materials List
app.Label.Visible=false;
app.CommonMaterialsLabel.Visible=false;
app.ReadPlotButton.Visible = true;
app.ImportRawXRDDataaswellCheckBox.Visible = true;
cla(app.UIAxes2);
cla(app.UIAxes);
end
% Menu selected function: TrainingModeMenu
function TrainingModeMenuSelected(app, event)
app.SampleMaterialsListBox.Visible=true; %Displays the Sample Materials List
app.Label.Visible=true;
app.CommonMaterialsLabel.Visible=true;
app.ReadPlotButton.Visible = false;
app.ImportRawXRDDataaswellCheckBox.Visible = false;
cla(app.UIAxes2);
cla(app.UIAxes);
end
% Value changed function: SampleMaterialsListBox
function SampleMaterialsListBoxValueChanged(app, event)
value = app.SampleMaterialsListBox.Value;
app.samplematerials(value);
end
% Clicked callback: SampleMaterialsListBox
function SampleMaterialsListBoxClicked(app, event)
item = event.InteractionInformation.Item;
end
% Changes arrangement of the app based on UIFigure width
function updateAppLayout(app, event)
currentFigureWidth = app.UIFigure.Position(3);
if(currentFigureWidth <= app.onePanelWidth)
% Change to a 2x1 grid
app.GridLayout.RowHeight = {753, 753};
app.GridLayout.ColumnWidth = {'1x'};
app.RightPanel.Layout.Row = 2;
app.RightPanel.Layout.Column = 1;
else
% Change to a 1x2 grid
app.GridLayout.RowHeight = {'1x'};
app.GridLayout.ColumnWidth = {309, '1x'};
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
end
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Get the file path for locating images
pathToMLAPP = fileparts(mfilename('fullpath'));
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.AutoResizeChildren = 'off';
app.UIFigure.Position = [100 100 1512 753];
app.UIFigure.Name = 'MATLAB App';
app.UIFigure.SizeChangedFcn = createCallbackFcn(app, @updateAppLayout, true);
% Create AcademicModeMenu
app.AcademicModeMenu = uimenu(app.UIFigure);
app.AcademicModeMenu.MenuSelectedFcn = createCallbackFcn(app, @AcademicModeMenuSelected, true);
app.AcademicModeMenu.Text = 'Academic Mode';
% Create TrainingModeMenu
app.TrainingModeMenu = uimenu(app.UIFigure);
app.TrainingModeMenu.MenuSelectedFcn = createCallbackFcn(app, @TrainingModeMenuSelected, true);
app.TrainingModeMenu.Text = 'Training Mode';
% Create GridLayout
app.GridLayout = uigridlayout(app.UIFigure);
app.GridLayout.ColumnWidth = {309, '1x'};
app.GridLayout.RowHeight = {'1x'};
app.GridLayout.ColumnSpacing = 0;
app.GridLayout.RowSpacing = 0;
app.GridLayout.Padding = [0 0 0 0];
app.GridLayout.Scrollable = 'on';
% Create LeftPanel
app.LeftPanel = uipanel(app.GridLayout);
app.LeftPanel.Layout.Row = 1;
app.LeftPanel.Layout.Column = 1;
% Create ReadPlotButton
app.ReadPlotButton = uibutton(app.LeftPanel, 'state');
app.ReadPlotButton.ValueChangedFcn = createCallbackFcn(app, @ReadPlotButtonValueChanged, true);
app.ReadPlotButton.Text = 'Read & Plot';
app.ReadPlotButton.FontSize = 18;
app.ReadPlotButton.FontWeight = 'bold';
app.ReadPlotButton.Position = [25 96 225 36];
% Create Image
app.Image = uiimage(app.LeftPanel);
app.Image.Position = [1 750 2 2];
% Create UITable
app.UITable = uitable(app.LeftPanel);
app.UITable.ColumnName = {'h'; 'k'; 'l'; 'Intensity'};
app.UITable.ColumnWidth = {50, 50, 50, 90};
app.UITable.RowName = {};
app.UITable.ColumnEditable = true;
app.UITable.CellEditCallback = createCallbackFcn(app, @UITableCellEdit2, true);
app.UITable.Position = [25 226 237 271];
% Create AtomicSizeSliderLabel
app.AtomicSizeSliderLabel = uilabel(app.LeftPanel);
app.AtomicSizeSliderLabel.HorizontalAlignment = 'right';
app.AtomicSizeSliderLabel.FontWeight = 'bold';
app.AtomicSizeSliderLabel.Position = [3 674 73 22];
app.AtomicSizeSliderLabel.Text = 'Atomic Size';
% Create AtomicSizeSlider
app.AtomicSizeSlider = uislider(app.LeftPanel);
app.AtomicSizeSlider.Limits = [2 98];
app.AtomicSizeSlider.ValueChangedFcn = createCallbackFcn(app, @AtomicSizeSliderValueChanged, true);
app.AtomicSizeSlider.ValueChangingFcn = createCallbackFcn(app, @AtomicSizeSliderValueChanging, true);
app.AtomicSizeSlider.FontWeight = 'bold';
app.AtomicSizeSlider.Position = [97 683 197 3];
app.AtomicSizeSlider.Value = 2;
% Create CrystalStructureDropDownLabel
app.CrystalStructureDropDownLabel = uilabel(app.LeftPanel);
app.CrystalStructureDropDownLabel.HorizontalAlignment = 'right';
app.CrystalStructureDropDownLabel.FontWeight = 'bold';
app.CrystalStructureDropDownLabel.Position = [21 187 102 22];
app.CrystalStructureDropDownLabel.Text = 'Crystal Structure';
% Create CrystalStructureDropDown
app.CrystalStructureDropDown = uidropdown(app.LeftPanel);
app.CrystalStructureDropDown.Items = {'SC', 'BCC', 'FCC'};
app.CrystalStructureDropDown.ValueChangedFcn = createCallbackFcn(app, @CrystalStructureDropDownValueChanged, true);
app.CrystalStructureDropDown.FontWeight = 'bold';
app.CrystalStructureDropDown.ClickedFcn = createCallbackFcn(app, @CrystalStructureDropDownClicked, true);
app.CrystalStructureDropDown.Position = [138 187 113 22];
app.CrystalStructureDropDown.Value = 'SC';
% Create LatticeSizeaEditFieldLabel
app.LatticeSizeaEditFieldLabel = uilabel(app.LeftPanel);
app.LatticeSizeaEditFieldLabel.HorizontalAlignment = 'right';
app.LatticeSizeaEditFieldLabel.FontWeight = 'bold';
app.LatticeSizeaEditFieldLabel.Position = [25 605 86 22];
app.LatticeSizeaEditFieldLabel.Text = 'Lattice Size(a)';
% Create LatticeSizeaEditField
app.LatticeSizeaEditField = uieditfield(app.LeftPanel, 'numeric');
app.LatticeSizeaEditField.ValueChangedFcn = createCallbackFcn(app, @LatticeSizeaEditFieldValueChanged, true);
app.LatticeSizeaEditField.Position = [126 605 100 22];
app.LatticeSizeaEditField.Value = 1;
% Create LatticeSizebEditFieldLabel
app.LatticeSizebEditFieldLabel = uilabel(app.LeftPanel);
app.LatticeSizebEditFieldLabel.HorizontalAlignment = 'right';
app.LatticeSizebEditFieldLabel.FontWeight = 'bold';
app.LatticeSizebEditFieldLabel.Position = [25 564 86 22];
app.LatticeSizebEditFieldLabel.Text = 'Lattice Size(b)';
% Create LatticeSizebEditField
app.LatticeSizebEditField = uieditfield(app.LeftPanel, 'numeric');
app.LatticeSizebEditField.ValueChangedFcn = createCallbackFcn(app, @LatticeSizebEditFieldValueChanged, true);
app.LatticeSizebEditField.Position = [126 564 100 22];
app.LatticeSizebEditField.Value = 1;
% Create LatticeSizecEditFieldLabel
app.LatticeSizecEditFieldLabel = uilabel(app.LeftPanel);
app.LatticeSizecEditFieldLabel.HorizontalAlignment = 'right';
app.LatticeSizecEditFieldLabel.FontWeight = 'bold';
app.LatticeSizecEditFieldLabel.Position = [25 524 86 22];
app.LatticeSizecEditFieldLabel.Text = 'Lattice Size(c)';
% Create LatticeSizecEditField
app.LatticeSizecEditField = uieditfield(app.LeftPanel, 'numeric');
app.LatticeSizecEditField.ValueChangedFcn = createCallbackFcn(app, @LatticeSizecEditFieldValueChanged, true);
app.LatticeSizecEditField.Position = [126 524 100 22];
app.LatticeSizecEditField.Value = 1;
% Create PlaneOpacitySwitchLabel
app.PlaneOpacitySwitchLabel = uilabel(app.LeftPanel);
app.PlaneOpacitySwitchLabel.HorizontalAlignment = 'center';
app.PlaneOpacitySwitchLabel.FontWeight = 'bold';
app.PlaneOpacitySwitchLabel.Position = [101 20 84 22];
app.PlaneOpacitySwitchLabel.Text = 'Plane Opacity';
% Create PlaneOpacitySwitch
app.PlaneOpacitySwitch = uiswitch(app.LeftPanel, 'slider');
app.PlaneOpacitySwitch.Items = {'Intensity', 'Slider'};
app.PlaneOpacitySwitch.ValueChangedFcn = createCallbackFcn(app, @PlaneOpacitySwitchValueChanged, true);
app.PlaneOpacitySwitch.Position = [109 57 69 30];
app.PlaneOpacitySwitch.Value = 'Intensity';
% Create ImportRawXRDDataaswellCheckBox
app.ImportRawXRDDataaswellCheckBox = uicheckbox(app.LeftPanel);
app.ImportRawXRDDataaswellCheckBox.Text = 'Import Raw XRD Data as well.';
app.ImportRawXRDDataaswellCheckBox.FontSize = 13;
app.ImportRawXRDDataaswellCheckBox.Position = [25 140 199 22];
% Create RightPanel
app.RightPanel = uipanel(app.GridLayout);
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
% Create GridLayout2
app.GridLayout2 = uigridlayout(app.RightPanel);
app.GridLayout2.ColumnWidth = {'15x', '17.71x'};
app.GridLayout2.RowHeight = {'1x', '18.33x', '1x', '5.54x'};
% Create UIAxes2
app.UIAxes2 = uiaxes(app.GridLayout2);
title(app.UIAxes2, 'Title')
xlabel(app.UIAxes2, 'X')
ylabel(app.UIAxes2, 'Y')
zlabel(app.UIAxes2, 'Z')
app.UIAxes2.XGrid = 'on';
app.UIAxes2.XMinorGrid = 'on';
app.UIAxes2.Layout.Row = 2;
app.UIAxes2.Layout.Column = 1;
% Create UIAxes
app.UIAxes = uiaxes(app.GridLayout2);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
zlabel(app.UIAxes, 'Z')
app.UIAxes.XGrid = 'on';
app.UIAxes.XMinorGrid = 'on';
app.UIAxes.YGrid = 'on';
app.UIAxes.YMinorGrid = 'on';
app.UIAxes.ZGrid = 'on';
app.UIAxes.ZMinorGrid = 'on';
app.UIAxes.Layout.Row = 2;
app.UIAxes.Layout.Column = 2;
% Create Image2
app.Image2 = uiimage(app.GridLayout2);
app.Image2.Layout.Row = [3 4];
app.Image2.Layout.Column = 2;
app.Image2.ImageSource = fullfile(pathToMLAPP, 'bg photo.png');
% Create OpacitySliderLabel
app.OpacitySliderLabel = uilabel(app.GridLayout2);
app.OpacitySliderLabel.HorizontalAlignment = 'right';
app.OpacitySliderLabel.FontWeight = 'bold';
app.OpacitySliderLabel.Layout.Row = 1;
app.OpacitySliderLabel.Layout.Column = 1;
app.OpacitySliderLabel.Text = 'Opacity';
% Create OpacitySlider
app.OpacitySlider = uislider(app.GridLayout2);
app.OpacitySlider.ValueChangedFcn = createCallbackFcn(app, @OpacitySliderValueChanged, true);
app.OpacitySlider.Layout.Row = 1;
app.OpacitySlider.Layout.Column = 2;
app.OpacitySlider.FontWeight = 'bold';
app.OpacitySlider.Value = 17.8155390703113;
% Create GridLayout3
app.GridLayout3 = uigridlayout(app.GridLayout2);
app.GridLayout3.RowHeight = {22, '1x'};
app.GridLayout3.Layout.Row = 4;
app.GridLayout3.Layout.Column = 1;
% Create SampleMaterialsListBox
app.SampleMaterialsListBox = uilistbox(app.GridLayout3);
app.SampleMaterialsListBox.Items = {'Platinium Nanoparticle (Pt)', 'Gold Nanoparticle (Au)', 'NaCl'};
app.SampleMaterialsListBox.ValueChangedFcn = createCallbackFcn(app, @SampleMaterialsListBoxValueChanged, true);
app.SampleMaterialsListBox.Visible = 'off';
app.SampleMaterialsListBox.Layout.Row = 2;
app.SampleMaterialsListBox.Layout.Column = 2;
app.SampleMaterialsListBox.ClickedFcn = createCallbackFcn(app, @SampleMaterialsListBoxClicked, true);
app.SampleMaterialsListBox.Value = 'Platinium Nanoparticle (Pt)';
% Create Label
app.Label = uilabel(app.GridLayout3);
app.Label.HorizontalAlignment = 'center';
app.Label.WordWrap = 'on';
app.Label.Visible = 'off';
app.Label.Layout.Row = 2;
app.Label.Layout.Column = 1;
app.Label.Text = 'You can select one of the following common materials that are listed to display their cubic cell structure.';
% Create CommonMaterialsLabel
app.CommonMaterialsLabel = uilabel(app.GridLayout3);
app.CommonMaterialsLabel.Visible = 'off';
app.CommonMaterialsLabel.Layout.Row = 1;
app.CommonMaterialsLabel.Layout.Column = 2;
app.CommonMaterialsLabel.Text = 'Common Materials';
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = BoolXRD
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end