-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathResuspension_GUI.m
1740 lines (1433 loc) · 67.5 KB
/
Resuspension_GUI.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
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
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
function varargout = Resuspension_GUI(varargin)
% Resuspension_GUI M-file for Resuspension_GUI.fig
% Resuspension_GUI, by itself, creates a new Resuspension_GUI or raises the existing
% singleton*.
%
% H = Resuspension_GUI returns the handle to a new Resuspension_GUI or the handle to
% the existing singleton*.
%
% Resuspension_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in Resuspension_GUI.M with the given input arguments.
%
% Resuspension_GUI('Property','Value',...) creates a new Resuspension_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the Resuspension_GUI before Resuspension_GUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Resuspension_GUI_OpeningFcn via varargin.
%
% *See Resuspension_GUI Options on GUIDE's Tools menu. Choose "Resuspension_GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Resuspension_GUI
% Last Modified by GUIDE v2.5 09-Mar-2017 11:59:49
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Resuspension_GUI_OpeningFcn, ...
'gui_OutputFcn', @Resuspension_GUI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Resuspension_GUI is made visible.
function Resuspension_GUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Resuspension_GUI (see VARARGIN)
clearvars -global
% Choose default command line output for Resuspension_GUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Resuspension_GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
[~,~,~] = property();
cpath = getcurrentdir();
if isdeployed
diary([cpath '\ErrorLog.log']);
end %if
set(handles.text1,'string','0')
initial_resetall(handles)
% Check for updates
checkupdate_Callback(hObject, eventdata, handles)
% --- Outputs from this function are returned to the command line.
function varargout = Resuspension_GUI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --------------------------------------------------------------------
function file_Callback(hObject, eventdata, handles)
% hObject handle to file (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function import_Callback(hObject, eventdata, handles)
% hObject handle to import (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
defaultpath = getcurrentdir();
[filename1,filepath1]=uigetfile({'*.xls;*.xlsx','Excel Files'},...
'Select Input Data Files to Import',defaultpath,'MultiSelect','on');
if (isa(filename1,'double'))
return
end %if
addnew(2,filename1,filepath1,hObject, eventdata, handles)
if (iscell(filename1) == 1)
txt = {[num2str(size(filename1,2)), ' files were imported, saved in MAT-files and added.'];...
'You can find the saved files in the same folder'};
else
txt = {'One file is imported, saved in MAT-file and added.';...
'You can find the saved file in the same folder'};
end %if
readytogo(handles)
msgbox(txt,'Import','Help','modal');
% --------------------------------------------------------------------
function open_Callback(hObject, eventdata, handles)
% hObject handle to open (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
defaultpath = getcurrentdir();
[filename1,filepath1]=uigetfile({'*.mat','MAT Files'},...
'Select Input Data Files to Open',defaultpath,'MultiSelect','on');
if (isa(filename1,'double'))
return
end %if
addnew(1,filename1,filepath1,hObject, eventdata, handles)
if (iscell(filename1) == 1)
txt = [num2str(size(filename1,2)), ' files were added'];
else
txt = 'One file was added';
end %if
readytogo(handles)
msgbox(txt,'Open','Help','modal');
% --------------------------------------------------------------------
function save_Callback(hObject, eventdata, handles)
% hObject handle to save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fig2 = figure();
copyobj(handles.axes1, Fig2);
hgsave(Fig2, 'myFigure.fig');
saveas(Fig2, 'myFigure.png','png');
delete(Fig2);
% --------------------------------------------------------------------
function exit_Callback(hObject, eventdata, handles)
% hObject handle to exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
figure1_CloseRequestFcn(handles.figure1, eventdata, handles)
% --------------------------------------------------------------------
function view_Callback(hObject, eventdata, handles)
% hObject handle to view (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function filled_Callback(hObject, eventdata, handles)
% hObject handle to filled (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global gsettings
if (strcmp(get(hObject,'Checked'),'on') == 1)
gsettings.markerfill = 0;
% set(hObject,'Checked','off')
else
gsettings.markerfill = 1;
% set(hObject,'Checked','on')
end%if
general_settings(1,handles)
% --------------------------------------------------------------------
function help_Callback(hObject, eventdata, handles)
% hObject handle to help (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function about_Callback(hObject, eventdata, handles)
% hObject handle to about (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[ver_no, ver_m] = gui_ver();
% temp = [char(169) ' 2014. All Rights Reserved.'];
% helpdlg({'Version: Beta'; 'Developer: Babak Nasr';'Prof. S. Dhaniyala Group';temp},'About')
helpdlg(ver_m,'About')
function uipushtool2_ClickedCallback(hObject, eventdata, handles)
% hObject handle to uipushtool2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
open_Callback(hObject, eventdata, handles)
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global pplot
pplot = 0;
select = get(handles.listbox1,'Value');
resetall(handles)
plotit(select,handles)
% --- Executes on button press in plotbutton.
function plotbutton_Callback(hObject, eventdata, handles)
% hObject handle to plotbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global x y l ll hll parlist xselect yselect pplot newx newy newl newll newhll lbond
persistent pselectedl
if (isempty(pselectedl) == 1)
pselectedl = '';
end %if
waitfunc(1,'retrieve', handles)
j = 0;
selectedl = {};
qty = [];
for i=1:size(parlist,1)
if (parlist{i,1} == true)
j = j + 1;
selectedl{j} = parlist{i,2};
[~, qty(j)] = detect(selectedl{j});
end %if
end %i
% sum(qty) == 2 means that there are only two qty parameters when the
% number of parameters are 3
if (((j > 0) && (j < 3))) || ((j == 3) && (sum(qty) == 2))
if (length(selectedl) == length(pselectedl))
if (all(strcmp(selectedl,pselectedl)) == 0)
pplot = 0;
end %if
else
pplot = 0;
end %if
[parlist,newx,newy,newll,newhll] = global_refinement(x,y,ll,hll,1,parlist);
newtable = settable(parlist,get(handles.checkboxrefine,'Value'));
set(handles.uitable2,'Data',newtable);
% [l, bond] = plotset(selectedl,l,parlist);
[newl, lbond] = plotset(selectedl,newll,parlist);
% assignin('base', 'x', x);
% assignin('base', 'y', y);
% assignin('base', 'newx', newx);
% assignin('base', 'newy', newy);
% assignin('base', 'l', l);
% assignin('base', 'newl', newl);
% assignin('base', 'll', ll);
% assignin('base', 'newll', newll);
% assignin('base', 'handles', handles);
switch pplot
case 0
resetall(handles)
legendset(newx,newy,newl,lbond,hObject, eventdata, handles)
% legendsetrefine(newx,newy,newl,bond,hObject, eventdata, handles)
xlabel([xselect ' (' punit(xselect) ')'],'fontWeight','bold')
ylabel([yselect ' (' punit(yselect) ')'],'fontWeight','bold')
ylim('auto')
xlim('auto')
% set(handles.refinebutton,'Visible','on')
pplot = 1;
case 1
% disp(':D')
xlimit = get(handles.axes1,'XLim');
ylimit = get(handles.axes1,'YLim');
legendset(newx,newy,newl,lbond,hObject, eventdata, handles)
% legendsetrefine(newx,newy,newl,bond,hObject, eventdata, handles)
set(handles.axes1,'XLim',xlimit,'YLim',ylimit)
end %switch
xrange = get(handles.axes1,'XLim');
yrange = get(handles.axes1,'YLim');
set(handles.yminedit,'String',yrange(1))
set(handles.ymaxedit,'String',yrange(2))
set(handles.xminedit,'String',xrange(1))
set(handles.xmaxedit,'String',xrange(2))
pselectedl = selectedl;
else
if (j > 3)
msgbox('Please Select at most three parameters', 'Too Many Arguments','Warn','modal')
else
if (j == 3)
msgbox({'Please Select two quantitative and one qualitative parameters in triple selection.'}, 'Wrong Selection','Warn','modal')
else
msgbox('Please Select at least one parameter', 'Wrong Selection','Warn','modal')
end %if
end %if
end %if
waitfunc(0,'retrieve', handles)
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox1
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
popupmenues(handles)
% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu2
popupmenues(handles)
% --- Executes on button press in ylog.
function ylog_Callback(hObject, eventdata, handles)
% hObject handle to ylog (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of ylog
% --------------------------------------------------------------------
function selectpoint_OffCallback(hObject, eventdata, handles)
% hObject handle to selectpoint (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes1);
datacursormode off
% --------------------------------------------------------------------
function selectpoint_OnCallback(hObject, eventdata, handles)
% hObject handle to selectpoint (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes1);
dcm_obj = datacursormode;
set(dcm_obj,'DisplayStyle','window','SnapToDataVertex','on',...
'UpdateFcn', @selectedpoint)
datacursormode on
function minedit_Callback(hObject, eventdata, handles)
% hObject handle to minedit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of minedit as text
% str2double(get(hObject,'String')) returns contents of minedit as a double
min1 = str2double(get(handles.minedit,'String'));
max1 = str2double(get(handles.maxedit,'String'));
if (min1 < max1)
legendchanged(1,handles)
else
msgbox('Wrong Input!','Error','Error','modal')
return
end %if
% --- Executes during object creation, after setting all properties.
function minedit_CreateFcn(hObject, eventdata, handles)
% hObject handle to minedit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function maxedit_Callback(hObject, eventdata, handles)
% hObject handle to maxedit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of maxedit as text
% str2double(get(hObject,'String')) returns contents of maxedit as a double
min1 = str2double(get(handles.minedit,'String'));
max1 = str2double(get(handles.maxedit,'String'));
if (min1 < max1)
legendchanged(1,handles)
else
warndlg('Wrong Input!','Error','Error','modal')
return
end %if
% --- Executes during object creation, after setting all properties.
function maxedit_CreateFcn(hObject, eventdata, handles)
% hObject handle to maxedit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function minedit2_Callback(hObject, eventdata, handles)
% hObject handle to minedit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of minedit2 as text
% str2double(get(hObject,'String')) returns contents of minedit2 as a double
min2 = str2double(get(handles.minedit2,'String'));
max2 = str2double(get(handles.maxedit2,'String'));
if (min2 < max2)
legendchanged(1,handles)
else
msg = msgbox('Wrong Input!','Error','Error','modal');
return
end %if
% --- Executes during object creation, after setting all properties.
function minedit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to minedit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function maxedit2_Callback(hObject, eventdata, handles)
% hObject handle to maxedit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of maxedit2 as text
% str2double(get(hObject,'String')) returns contents of maxedit2 as a double
min2 = str2double(get(handles.minedit2,'String'));
max2 = str2double(get(handles.maxedit2,'String'));
if (min2 < max2)
legendchanged(1,handles)
else
warndlg('Wrong Input!','Error','Error','modal')
return
end %if
% --- Executes during object creation, after setting all properties.
function maxedit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to maxedit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on mouse press over axes background.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function qtylegrev_Callback(hObject, eventdata, handles)
% hObject handle to qtylegrev (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global gsettings
if (strcmp(get(hObject,'Checked'),'on') == 1)
gsettings.qtyrl = 0;
% set(hObject,'Checked','off')
else
gsettings.qtyrl = 1;
% set(hObject,'Checked','on')
end%if
general_settings(1,handles)
% --------------------------------------------------------------------
function qlylegrev_Callback(hObject, eventdata, handles)
% hObject handle to qlylegrev (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global gsettings
if (strcmp(get(hObject,'Checked'),'on') == 1)
gsettings.qlyrl = 0;
% set(hObject,'Checked','off')
else
gsettings.qlyrl = 1;
% set(hObject,'Checked','on')
end%if
general_settings(1,handles)
% --- Executes on button press in checkboxrefine.
function checkboxrefine_Callback(hObject, eventdata, handles)
% hObject handle to checkboxrefine (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkboxrefine
global ll parlist resetg pplot
resetg = 1;
switch get(hObject,'Value')
case 0
set(handles.realtimecheckbox,'Enable','off')
%reset refinments in parlist
tableget = get(handles.uitable2,'Data');
parlist = minmaxvalues(ll);
for i=1:size(parlist,1)
parlist{i,1} = tableget{i,1};
end %i
newtable = settable(parlist,0);
set(handles.uitable2,'Data',newtable,'ColumnName',{'','Available Parameters','Unit','Min','Max','Qualitative Values'},...
'ColumnFormat',{'logical','char','char','char','char','char'},'ColumnWidth',{20,'auto','auto','auto','auto','auto'},...
'ColumnEditable',[true false false false false false])
set(handles.resetrefinebutton,'Enable','off')
pplot = 0;
case 1
set(handles.realtimecheckbox,'Enable','on')
newtable = settable(parlist,1);
set(handles.uitable2,'Data',newtable,'ColumnName',...
{'','Available Parameters','Unit','Min','Max','Adj. Min','Adj. Max','NaN','Qualitative Values'},...
'ColumnFormat',{'logical','char','char','char','char','char','char','logical','char'},...
'ColumnWidth',{20,'auto','auto','auto','auto','auto','auto',30,'auto'},...
'ColumnEditable',[true false false false false true true true false])
set(handles.resetrefinebutton,'Enable','on')
end %switch get(hObject,'Value')
% --- Executes when selected cell(s) is changed in uitable2.
function uitable2_CellSelectionCallback(hObject, eventdata, handles)
% hObject handle to uitable2 (see GCBO)
% eventdata structure with the following fields (see UITABLE)
% Indices: row and column indices of the cell(s) currently selecteds
% handles structure with handles and user data (see GUIDATA)
global parlist
selection = eventdata.Indices;
if (size(selection,1) == 1)
tableget = get(hObject,'Data');
switch get(handles.checkboxrefine,'Value')
case 1
if (selection(2) == 9) && (isempty(tableget{selection(1),selection(2)}) == 0)
set(handles.uitablechoose,'Data',parlist{selection(1),9},...
'ColumnName',{'','Value'},'ColumnFormat',{'logical' 'char'},...
'ColumnWidth',{20,120},'ColumnEditable',[true false],'Visible','on')
set(handles.cancelchoose,'visible','on')
set(handles.choosepanel,'Title',parlist{selection(1),2},'Visible','on')
%Enable off
setenable('off',hObject, eventdata, handles)
end %if
case 0
if (selection(2) == 6) && (isempty(tableget{selection(1),selection(2)}) == 0)
set(handles.uitablechoose,'Data',parlist{selection(1),9}(:,2),...
'ColumnName',{'Value'},'ColumnFormat',{'char'},...
'ColumnWidth',{120},'ColumnEditable',[false],'Visible','on')
set(handles.cancelchoose,'visible','off')
set(handles.choosepanel,'Title',parlist{selection(1),2},'Visible','on')
%Enable off
setenable('off',hObject, eventdata, handles)
% uistack(handles.uitable2,'bottom')
% uistack(handles.uitablechoose,'top')
% uistack(handles.okchoose,'top')
% uistack(handles.cancelchoose,'top')
% uistack(handles.choosepanel,'top')
end %if
end %switch
end %if
% --- Executes when entered data in editable cell(s) in uitable2.
function uitable2_CellEditCallback(hObject, eventdata, handles)
% hObject handle to uitable2 (see GCBO)
% eventdata structure with the following fields (see UITABLE)
% Indices: row and column indices of the cell(s) edited
% PreviousData: previous data for the cell(s) edited
% EditData: string(s) entered by the user
% NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
% Error: error string when failed to convert EditData to appropriate value for Data
% handles structure with handles and user data (see GUIDATA)
global x y ll hll parlist
%persistent newx newy newl newll
% if (isempty(newll) == 1) || (resetg == 1)
% newll = ll;
% newl = l;
% newy = y;
% newx = x;
% resetg = 0;
% end %if
er = [0, 0];
if (get(handles.checkboxrefine,'Value') == 1)
tableget = get(hObject,'Data');
[er, err] = checkrefine2(tableget,eventdata.Indices,eventdata.NewData);
if (er(1) > 0) || (er(2) > 0)
eventdata.NewData = eventdata.PreviousData;
refreshtable = settable(parlist,1);
set(hObject,'Data',refreshtable)
end %if
end %if
parlist{eventdata.Indices(1),eventdata.Indices(2)} = eventdata.NewData;
if (get(handles.realtimecheckbox,'Value') == 1)
if ((er(1) == 0) && (er(2) == 0) && (eventdata.Indices(2) >= 6) && (xor((strcmpi(eventdata.NewData,'min') == 0),(strcmpi(eventdata.NewData,'max') == 0)) == 0))
istart = eventdata.Indices(1);
[parlist,~,~,~] = global_refinement(x,y,ll,hll,istart,parlist);
% [newx, newy, newll] = refine2(x,y,ll,eventdata.Indices(1),parlist);
% for i=1:size(parlist,1)
% if (i ~= eventdata.Indices(1))
% [newx, newy, newll] = refine2(newx,newy,newll,i,parlist);
% end %if
% end %i
% list2 = minmaxvalues(newll);
% for i=1:size(parlist,1)
% parlist{i,6} = list2{i,4};
% parlist{i,7} = list2{i,5};
% if (isempty(parlist{i,9}) == 0)
% for j=1:size(parlist{i,9},1)
% parlist{i,9}{j,1} = false;
% for k=1:size(list2{i,9},1)
% if (strcmp(parlist{i,9}{j,2},list2{i,9}{k,2}) == 1)
% parlist{i,9}{j,1} = true;
% break
% end %if
% end %k
% end %j
% end %if
% end %i
newtable = settable(parlist,1);
set(hObject,'Data',newtable);
end %if
end %if
if (er(1) > 0)
msgbox(err,'Input error','Error','modal')
end %if
% --- Executes on button press in realtimecheckbox.
function realtimecheckbox_Callback(hObject, eventdata, handles)
% hObject handle to realtimecheckbox (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of realtimecheckbox
% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: delete(hObject) closes the figure
% diary('off') % ACTIVATE IT LATER
delete(hObject);
% --- Executes on button press in okchoose.
function okchoose_Callback(hObject, eventdata, handles)
% hObject handle to okchoose (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global parlist x y ll hll
switch get(handles.checkboxrefine,'Value')
case 1
valueget = get(handles.uitablechoose,'Data');
j = 0;
for i=1:size(valueget,1)
if (valueget{i,1} == true)
j = j + 1;
end %if
end %i
if (j > 0)
index = find(strcmp(parlist(:,2),get(handles.choosepanel,'Title')),1);
parlist{index,9} = valueget;
if (get(handles.realtimecheckbox,'Value') == 1)
istart = index;
[parlist,~,~,~] = global_refinement(x,y,ll,hll,istart,parlist);
end %if
newtable = settable(parlist,1);
set(handles.uitable2,'Data',newtable);
set(handles.choosepanel,'Visible','off')
setenable('on',hObject, eventdata, handles)
else
msgbox('Please select at least one value','Selection','Warn','modal')
end %if
case 0
set(handles.choosepanel,'Visible','off')
setenable('on',hObject, eventdata, handles)
end %switch
% --- Executes on button press in cancelchoose.
function cancelchoose_Callback(hObject, eventdata, handles)
% hObject handle to cancelchoose (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.choosepanel,'Visible','off')
setenable('on',hObject, eventdata, handles)
% --- Executes on button press in applychangebutton.
function applychangebutton_Callback(hObject, eventdata, handles)
% hObject handle to applychangebutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
applylegchanges(handles)
% --- Executes when entered data in editable cell(s) in legendtable.
function legendtable_CellEditCallback(hObject, eventdata, handles)
% hObject handle to legendtable (see GCBO)
% eventdata structure with the following fields (see UITABLE)
% Indices: row and column indices of the cell(s) edited
% PreviousData: previous data for the cell(s) edited
% EditData: string(s) entered by the user
% NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
% Error: error string when failed to convert EditData to appropriate value for Data
% handles structure with handles and user data (see GUIDATA)
tableget = get(hObject,'Data');
j = 0;
for i=1:size(tableget,1)
if (tableget{i,1} == true)
j = j + 1;
end %if
end %i
if (j == 0)
tableget{eventdata.Indices(1),eventdata.Indices(2)} = eventdata.PreviousData;
set(hObject,'Data',tableget);
end %if
legendchanged(1,handles)
% --- Executes when entered data in editable cell(s) in legendtable2.
function legendtable2_CellEditCallback(hObject, eventdata, handles)
% hObject handle to legendtable2 (see GCBO)
% eventdata structure with the following fields (see UITABLE)
% Indices: row and column indices of the cell(s) edited
% PreviousData: previous data for the cell(s) edited
% EditData: string(s) entered by the user
% NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
% Error: error string when failed to convert EditData to appropriate value for Data
% handles structure with handles and user data (see GUIDATA)
tableget = get(hObject,'Data');
j = 0;
for i=1:size(tableget,1)
if (tableget{i,1} == true)
j = j + 1;
end %if
end %i
if (j == 0)
tableget{eventdata.Indices(1),eventdata.Indices(2)} = eventdata.PreviousData;
set(hObject,'Data',tableget);
end %if
legendchanged(1,handles)
% --------------------------------------------------------------------
function view2d_ClickedCallback(hObject, eventdata, handles)
% hObject handle to view2d (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes1);
view(2)
set(handles.rotate3d,'State','off')
% --------------------------------------------------------------------
function tools_menu_Callback(hObject, eventdata, handles)
% hObject handle to tools_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function rebuild_menu_Callback(hObject, eventdata, handles)
% hObject handle to rebuild_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% creat new window and its object
description = 'Select parameter, then appropriate criteria to eliminate remain data-points.';
h2.fig = dialog('WindowStyle', 'modal', 'Name', 'Regenerate DataSet',...
'Position',[520 650 299 159]);
h2.maintext = uicontrol('style','text','position',[10 115 276 37],...
'string',description,'HorizontalAlignment','left');
h2.text1 = uicontrol('style','text','position',[10 83 148 15],...
'string','Select Parameter:','HorizontalAlignment','left');
h2.text2 = uicontrol('style','text','position',[196 83 91 15],...
'string','Select Criteria:','HorizontalAlignment','left');
h2.popup1 = uicontrol('style','popupmenu','position',[10 59 150 21],...
'string',{'Select'},'BackgroundColor',[1 1 1]);
h2.popup2 = uicontrol('style','popupmenu','position',[196 59 93 21],...
'string',{'Max','Mean','Median','Min'},'BackgroundColor',[1 1 1]);
h2.button1 = uicontrol('style','pushbutton','position',[62 9 80 26],...
'string','OK','Callback',{@reduce_OK_Callback,h2,handles});
h2.button2 = uicontrol('style','pushbutton','position',[162 9 80 26],...
'string','Cancel','Callback',{@reduce_Cancel_Callback,h2});
%*******
list = get(handles.popupmenu1,'string');
set(h2.popup1,'string',list);
function reduce_OK_Callback(hObject, eventdata, h2, handles)
global wd whd iwd iwhd
if ((isempty(iwd) == 1) && (isempty(iwhd) == 1))
iwd = wd;
iwhd = whd;
end %if
waitfunc(1,'rebuilt', handles)
list = get(h2.popup1,'String');
i = get(h2.popup1,'Value');
if iscell(list) == 1
par = list{i};
else
par = list;
end %if
olist = get(h2.popup2,'String');
j = get(h2.popup2,'Value');
[wd, whd] = rebuilt(wd,whd,par,olist{j});
alist = checkdata(wd);
adddata2(alist,hObject,eventdata,handles);
set(handles.initial_dataset,'Enable','on')
set(handles.alerttext,'Visible','on')
popupmenues(handles);
delete(h2.fig);
waitfunc(0,'rebuilt', handles)
assignin('base', 'whd', whd);
assignin('base', 'wd', wd);
function reduce_Cancel_Callback(hObject, eventdata, h2)
delete(h2.fig);
% --------------------------------------------------------------------
function initial_dataset_Callback(hObject, eventdata, handles)
% hObject handle to initial_dataset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global wd whd iwd iwhd parlist
wd = iwd;
whd = iwhd;
clear iwd iwhd
alist = checkdata(wd);
adddata2(alist,hObject,eventdata,handles);
set(handles.initial_dataset,'Enable','off')
set(handles.alerttext,'Visible','off')
popupmenues(handles);
msgbox('The initial DataSet has been set','Initialize','Help','modal')
% --------------------------------------------------------------------
function analysis_m_Callback(hObject, eventdata, handles)
% hObject handle to analysis_m (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function analysis_detach_Callback(hObject, eventdata, handles)
% hObject handle to analysis_detach (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
theory_readytogo(handles)
% --- Executes on button press in sublayercheckbox.
function sublayercheckbox_Callback(hObject, eventdata, handles)
% hObject handle to sublayercheckbox (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of sublayercheckbox
% --- Executes on button press in burstcheckbox.
function burstcheckbox_Callback(hObject, eventdata, handles)
% hObject handle to burstcheckbox (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of burstcheckbox
% --- Executes on button press in liftingcheckbox.
function liftingcheckbox_Callback(hObject, eventdata, handles)
% hObject handle to liftingcheckbox (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of liftingcheckbox
% --- Executes on button press in slidingcheckbox.
function slidingcheckbox_Callback(hObject, eventdata, handles)
% hObject handle to slidingcheckbox (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of slidingcheckbox
theory_propdetect(handles)
% --- Executes on button press in rollingcheckbox.
function rollingcheckbox_Callback(hObject, eventdata, handles)
% hObject handle to rollingcheckbox (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rollingcheckbox
% --- Executes on button press in jkrcheckbox.
function jkrcheckbox_Callback(hObject, eventdata, handles)
% hObject handle to jkrcheckbox (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of jkrcheckbox
% --- Executes on button press in dmtcheckbox.
function dmtcheckbox_Callback(hObject, eventdata, handles)
% hObject handle to dmtcheckbox (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of dmtcheckbox