-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVSgui.m
More file actions
1201 lines (925 loc) · 39.3 KB
/
VSgui.m
File metadata and controls
1201 lines (925 loc) · 39.3 KB
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 = VSgui(varargin)
% VSGUI MATLAB code for VSgui.fig
% VSGUI, by itself, creates a new VSGUI or raises the existing
% singleton*.
%
% H = VSGUI returns the handle to a new VSGUI or the handle to
% the existing singleton*.
%
% VSGUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in VSGUI.M with the given input arguments.
%
% VSGUI('Property','Value',...) creates a new VSGUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before VSgui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to VSgui_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help VSgui
% Last Modified by GUIDE v2.5 19-Sep-2025 18:34:45
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @VSgui_OpeningFcn, ...
'gui_OutputFcn', @VSgui_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
%disp('varargin{:}')
%varargin{:} % for debugging
%disp('gui_State')
%gui_State % for debugging
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before VSgui is made visible.
function VSgui_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 VSgui (see VARARGIN)
% Choose default command line output for VSgui
handles.output = hObject;
% Update handles structure
global ex myhandles
ex.setup.VSdirRoot = pwd;
addpath([ex.setup.VSdirRoot '/guiHelpers']);
guidata(hObject, handles);
updateStoredEyecalList(handles)
updateExptSetupFlist(handles)
initializeGui(handles)
updateStimParamsList(handles)
setGuiVariables(handles);
set(handles.figure1,'position',[0 37.3 195.3333 49.0833]);
guidata(hObject,handles); % get updated handles
myhandles = handles;
% --- Outputs from this function are returned to the command line.
function varargout = VSgui_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;
% --- Executes on selection change in storedExperiments.
function storedExperiments_Callback(hObject, eventdata, handles)
global ex
exp_list = cellstr(get(hObject,'String')) ;% returns StoredExperiments_listbox contents as cell array
fname = exp_list{get(hObject,'Value')}; % returns selected item from StoredExperiments_listbox
idir = fileparts(ex.setup.VSdirRoot);
setupfile = fullfile(idir,'setupFiles','ExptSetupFiles',...
sprintf('%s.setup',fname));
loadExptSetupFile(hObject,handles,setupfile);
function storedExperiments_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp_type_Callback(hObject, eventdata, handles)
global ex
eName = sprintf('e%d',eNumber(hObject.Tag));
exp_list = hObject.String;
etype = exp_list{hObject.Value};
if strcmpi(etype,'none') % remove other input if no exp is selected
handles.(sprintf('%s_min',eName)).String = [];
handles.(sprintf('%s_inc',eName)).String = [];
handles.(sprintf('%s_range',eName)).String = [];
ex.exp = rmfield(ex.exp,eName);
else
ex.exp.(eName).type = etype;
%ex = getExptSettings(ex,etype);
nex = getExptSettings(ex,etype);
ex.exp.(eName) = nex.exp.e1;
ex.stim.vals = nex.stim.vals; % hn hack to deal with loss of image folder
end
setGuiVariables(handles);
function exp_min_Callback(hObject, eventdata, handles)
global ex
eName = sprintf('e%d',eNumber(hObject.Tag));
ex.exp.(eName).min = str2double(get(hObject,'String'));
setGuiVariables(handles);
function exp_inc_Callback(hObject, eventdata, handles)
global ex
eName = sprintf('e%d',eNumber(hObject.Tag));
ex.exp.(eName).inc = str2double(get(hObject,'String'));
setGuiVariables(handles);
function exp_nsamples_Callback(hObject, eventdata, handles)
global ex
eName = sprintf('e%d',eNumber(hObject.Tag));
ex.exp.(eName).nsamples = str2double(hObject.String);
setGuiVariables(handles);
function exp_scale_Callback(hObject, eventdata, handles)
global ex
scale_list = cellstr(get(hObject,'String'));
eName = sprintf('e%d',eNumber(hObject.Tag));
ex.exp.(eName).scale = scale_list{get(hObject,'Value')};
setGuiVariables(handles);
function exp_range_Callback(hObject, eventdata, handles)
global ex
eName = sprintf('e%d',eNumber(hObject.Tag));
ex.exp.(eName).range = sort(str2num(hObject.String));
ex.exp.(eName).scale = 'range';
setGuiVariables(handles);
function n = eNumber(tag)
for i=1:5
if contains(tag,sprintf('exp%d',i))
n = i;
break
end
end
function exp1_type_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp1_min_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp1_inc_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp1_scale_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp1_nsamples_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp1_range_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp2_type_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp2_min_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp2_inc_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp2_nsamples_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp2_scale_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp2_range_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp3_type_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp3_min_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp3_inc_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp3_nsamples_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp3_scale_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp3_range_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp4_type_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp4_min_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp4_inc_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp4_nsamples_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp4_scale_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp4_range_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp5_type_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp5_min_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp5_inc_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp5_scale_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp5_nsamples_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function exp5_range_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function afc_Callback(hObject, eventdata, handles)
global ex
ex.exp.afc = get(hObject,'Value');
setGuiVariables(handles);
function include_blank_Callback(hObject, eventdata, handles)
global ex
ex.exp.include_blank = get(hObject,'Value');
setGuiVariables(handles);
function stimulus_type_Callback(hObject, eventdata, handles)
global ex
stim_list = cellstr(get(hObject,'String'));
ex.stim.type = stim_list{get(hObject,'Value')};
setGuiVariables(handles);
function stimulus_type_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function mask_type_Callback(hObject, eventdata, handles)
global ex
mask_list = cellstr(get(hObject,'String'));
ex.stim.masktype = mask_list{get(hObject,'Value')};
setGuiVariables(handles);
function mask_type_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function include_monoc_Callback(hObject, eventdata, handles)
global ex
ex.exp.include_monoc = get(hObject,'Value');
setGuiVariables(handles);
function binoc_eyeSignals_Callback(hObject, eventdata, handles)
global ex
eye_list = cellstr(get(hObject,'String'));
ocularity = eye_list{get(hObject,'Value')};
switch ocularity
case 'monocular'
ex.setup.el.binoc = 0;
ex.setup.adc.Channels = [0:2]; % channels 0 to 2 for monocular data
ex.setup.adc.DiffChannels = [0,0,0]; % 0:= compute no differential voltages;
case 'binocular'
ex.setup.el.binoc = 1;
ex.setup.adc.Channels = [0:5]; % channels 0 to 5 for binocular data
ex.setup.adc.DiffChannels = [0,0,0,0,0,0]; % 0:= compute no differential voltages;
end
setGuiVariables(handles);
function binoc_eyeSignals_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function recording_Callback(hObject, eventdata, handles)
global ex
ex.setup.recording = get(hObject,'Value');
setGuiVariables(handles);
function iontophoresis_Callback(hObject, eventdata, handles)
global ex
ex.setup.iontophoresis.on = get(hObject,'Value');
% if we record the iontophoresis signals we need to open two additional
% analog channels
if ex.setup.iontophoresis.on
ex.setup.adc.Channels = [ex.setup.adc.Channels, [1,2]+ ex.setup.adc.Channels(end)];
ex.setup.adc.DiffChannels = [ex.setup.adc.DiffChannels, 0,0];
end
setGuiVariables(handles);
function nreps_Callback(hObject, eventdata, handles)
global ex;
ex.exp.nreps = str2double(get(hObject,'String'));
setGuiVariables(handles);
function nreps_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function fixWinW_Callback(hObject, eventdata, handles)
global ex
ex.fix.WinW = str2double(get(hObject,'String'));
setGuiVariables(handles);
% --- Executes during object creation, after setting all properties.
function fixWinW_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function fixWinH_Callback(hObject, eventdata, handles)
global ex
ex.fix.WinH = str2double(get(hObject,'String'));
setGuiVariables(handles);
% --- Executes during object creation, after setting all properties.
function fixWinH_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function LeftHemisphere_Callback(hObject, eventdata, handles)
global ex
val = get(hObject,'Value');
ex.setup.leftHemisphereRecorded = val;
function RightHemisphere_Callback(hObject, eventdata, handles)
global ex
val = get(hObject,'Value');
ex.setup.rightHemisphereRecorded = val;
function Left_Hemisphere_gridX_Callback(hObject, eventdata, handles)
global ex
ex.setup.Left_Hemisphere_gridX = str2double(get(hObject,'String'));
setGuiVariables(handles);
% --- Executes during object creation, after setting all properties.
function Left_Hemisphere_gridX_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Left_Hemisphere_gridY_Callback(hObject, eventdata, handles)
global ex
ex.setup.Left_Hemisphere_gridY = str2double(get(hObject,'String'));
setGuiVariables(handles);
% --- Executes during object creation, after setting all properties.
function Left_Hemisphere_gridY_CreateFcn(hObject, eventdata, handles)
% hObject handle to Left_Hemisphere_gridY (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 Right_Hemisphere_gridX_Callback(hObject, eventdata, handles)
global ex
ex.setup.Right_Hemisphere_gridX = str2double(get(hObject,'String'));
setGuiVariables(handles);
% --- Executes during object creation, after setting all properties.
function Right_Hemisphere_gridX_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Right_Hemisphere_gridY_Callback(hObject, eventdata, handles)
global ex
ex.setup.Right_Hemisphere_gridY = str2double(get(hObject,'String'));
setGuiVariables(handles);
function Right_Hemisphere_gridY_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function reward_time_Callback(hObject, eventdata, handles)
global ex
ex.reward.time = str2double(get(hObject,'String'));
function reward_time_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in runExpt.
function runExpt_Callback(hObject, eventdata, handles)
global ex
runExpt;
function openDisplay_Callback(hObject, eventdata, handles)
global ex
initDatapixx(ex);
ex = initDisplay(ex);
% --- Executes on button press in closeDisplay.
function closeDisplay_Callback(hObject, eventdata, handles)
global ex
closeVS(ex) % need to change
% --- Executes on button press in runTrial.
function runTrial_Callback(hObject, eventdata, handles)
global ex
if ex.exp.afc
ex = runTrialTask(ex);
else
ex = runTrialStim(ex);
end
function fix_duration_Callback(hObject, eventdata, handles)
global ex
ex.fix.duration = str2double(get(hObject,'String'));
if isfield(ex.exp,'blockedFreeViewing') && ex.exp.blockedFreeViewing
ex.fix.blockedFreeViewing.duration(ex.freeViewing+1) = ex.fix.duration;
end
setGuiVariables(handles);
function fix_duration_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function calibrateEye_Callback(hObject, eventdata, handles)
global ex
% persistent inProgress % avoid multiple calls to this function after buttonpress
% if isempty(inProgress)
% inProgress = 1;
% else return
% end
try
types_cal = cellstr(get(handles.typeEyeCalibration,'String'));
type_calibration = types_cal{get(handles.typeEyeCalibration,'Value')};
switch type_calibration
case 'short'
disp('in short eye calibration rev')
ex = calibrateEye_rev(ex);
case 'long'
ex = calibrateEye_long(ex);
end
catch
% ignore errors
end
%inProgress = [];
function typeEyeCalibration_Callback(hObject, eventdata, handles)
function typeEyeCalibration_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function sf_Callback(hObject, eventdata, handles)
global ex
ex.stim.vals.sf = str2num(get(hObject,'String'));
setGuiVariables(handles);
function sf_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function tf_Callback(hObject, eventdata, handles)
global ex
ex.stim.vals.tf = str2num(get(hObject,'String'));
setGuiVariables(handles);
function tf_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function or_Callback(hObject, eventdata, handles)
global ex
ex.stim.vals.or = str2num(get(hObject,'String'));
setGuiVariables(handles);
function or_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function x0_Callback(hObject, eventdata, handles)
global ex
ex.stim.vals.x0 = str2num(get(hObject,'String'));
setGuiVariables(handles);
function x0_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function nStimPerTrial_Callback(hObject, eventdata, handles)
global ex
ex.exp.StimPerTrial = str2num(get(hObject,'String'));
setGuiVariables(handles);
function nStimPerTrial_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function y0_Callback(hObject, eventdata, handles)
global ex
ex.stim.vals.y0 = str2num(get(hObject,'String'));
setGuiVariables(handles);
function y0_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function hdx_Callback(hObject, eventdata, handles)
global ex
ex.stim.vals.hdx = str2num(get(hObject,'String'));
setGuiVariables(handles);
function hdx_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function wi_Callback(hObject, eventdata, handles)
global ex
ex.stim.vals.wi = str2num(get(hObject,'String'));
setGuiVariables(handles);
function wi_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function hi_Callback(hObject, eventdata, handles)
global ex
ex.stim.vals.hi = str2num(get(hObject,'String'));
setGuiVariables(handles);
function hi_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function stimParams_Callback(hObject, eventdata, handles)
global ex
setGuiVariables(handles);
guidata(hObject,handles);
function stimParams_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function stimVals_Callback(hObject, eventdata, handles)
global ex
% get selected parameter from stimParams listbox
param_list = cellstr(get(handles.stimParams,'String'));
param_selected = param_list{get(handles.stimParams,'Value')};
param = strtok(param_selected,' ');
%get stimulus value from user input
val = (get(hObject,'String'));
switch param
case 'dcol'
eval(['ex.stim.vals.' param ' = val;']);
otherwise
val_num = eval(['[' val '];']);
eval(['ex.stim.vals.' param ' = val_num;']);
end
setGuiVariables(handles);
function stimVals_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Animal_Callback(hObject, eventdata, handles)
global ex
name_list = cellstr(get(hObject,'String'));
animal = name_list{get(hObject,'Value')} ;
ex.Header.animal = animal;
switch animal
case 'kiwi'
ex.setup.filePrefix = 'ki';
case 'mango'
ex.setup.filePrefix = 'ma';
case 'lemieux'
ex.setup.filePrefix = 'le';
case 'barnum'
ex.setup.filePrefix = 'ba';
case 'hummus'
ex.setup.filePrefix = 'hu';
case 'tempura'
ex.setup.filePrefix = 'te';
case 'jocamo'
ex.setup.filePrefix = 'jo';
case 'tamago'
ex.setup.filePrefix = 'ta';
case 'kaki'
ex.setup.filePrefix = 'ka';
case 'lychee'
ex.setup.filePrefix = 'ly';
otherwise
ex.setup.filePrefix = animal;
end
function Animal_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Comment_Callback(hObject, eventdata, handles)
global ex
comment = get(hObject,'String');
if isfield(ex,'comment')
ex.comment(length(ex.comment)+1).text = comment;
else
ex.comment(1).text = comment;
end
if isfield(ex,'j')
ex.comment(length(ex.comment)).trialNum = ex.j;
else ex.comment(length(ex.comment)).trialNum = NaN;
end
set(hObject,'String','');
function Comment_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function storedEyeCalibrations_Callback(hObject, eventdata, handles)
global ex
stored_eyeCals = cellstr(get(hObject,'String'));
fname = stored_eyeCals{get(hObject,'Value')} ;
cur_dir = pwd;
cd (ex.setup.VSdirRoot)
cd ..
idir = pwd;
cd(cur_dir);
eyeCalfile = [idir '/setupFiles/EyecalibrationSetupFiles/' fname '.eyeCal']
loadStoredEyecal(hObject,handles,eyeCalfile)
function storedEyeCalibrations_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function saveEyeCalibration_Callback(hObject, eventdata, handles)
global ex
curr_dir = pwd;
cd ([ex.setup.VSdirRoot ]);
cd ../setupFiles/EyeCalibrationSetupFiles
[file path] = uiputfile('*.eyeCal','Save as');
if file %if 'cancel' was not pressed
file = [path file];
eyeCal = ex.eyeCal;
save(file,'eyeCal')
end
updateStoredEyecalList(handles)
cd (curr_dir)
function saveExptSetup_Callback(hObject, eventdata, handles)
global ex
curr_dir = pwd;
cd ([ex.setup.VSdirRoot ]);
cd ../setupFiles/ExptSetupFiles
[file path] = uiputfile('*.setup','Save as');
if file %if 'cancel' was not pressed
file = [path file];
save(file,'ex')
end
cd (curr_dir)
updateExptSetupFlist(handles)
function openEyelink_Callback(hObject, eventdata, handles)
global ex
ex = initEyelink(ex,handles);
function closeEyelink_Callback(hObject, eventdata, handles)
global ex
closeEyelink(ex);
ex.setup.el.elstart = [];
ex.setup.el.hasSamples = 0;
function SessionID_Callback(hObject, eventdata, handles)
global ex
ex.Header.SessionID = get(hObject,'String');
setGuiVariables(handles);
function SessionID_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function earlyReward_Callback(hObject, eventdata, handles)
global ex
ex.reward.earlyRewardTime = str2double(get(hObject,'String'));
if isfield(ex.exp,'blockedFreeViewing') && ex.exp.blockedFreeViewing
ex.reward.blockedFreeViewing.earlyRewardTime(ex.freeViewing+1) = ...
ex.reward.earlyRewardTime;
end
setGuiVariables(handles);
function earlyReward_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function duration_forEarlyReward_Callback(hObject, eventdata, handles)
global ex
ex.fix.duration_forEarlyReward = eval(['[' get(hObject,'String') ']']);
setGuiVariables(handles);
function duration_forEarlyReward_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function fixPCtr_Callback(hObject, eventdata, handles)
global ex
ex.fix.PCtr = eval(['[' get(hObject,'String') ']']);
setGuiVariables(handles);
function fixPCtr_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in storeNeuralData.
function storeNeuralData_Callback(hObject, eventdata, handles)
recording = get(hObject,'Value')
global ex
ex.setup.recording = recording;
% --- Executes on selection change in targIconType.
function targIconType_Callback(hObject, eventdata, handles)
global ex
targ_list = cellstr(get(hObject,'String'));
ex.targ.icon.type = targ_list{get(hObject,'Value')};
setGuiVariables(handles);
function targIconType_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in targIconParamList.
function targIconParamList_Callback(hObject, eventdata, handles)
global ex
param_list = cellstr(get(hObject,'String'));
param_selected = param_list{get(hObject,'Value')};
param = strtok(param_selected,' ');
val = eval(['ex.targ.icon.' param ';']);
% display the value of the selected stimulus parameter for editing
if ischar(val)
set(handles.targIconVals,'String',val);
else set(handles.targIconVals,'String',num2str(val));
end
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function targIconParamList_CreateFcn(hObject, eventdata, handles)
% hObject handle to targIconParamList (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
function targIconVals_Callback(hObject, eventdata, handles)
global ex
% get selected parameter from stimParams listbox
param_list = cellstr(get(handles.targIconParamList,'String'));
param_selected = param_list{get(handles.targIconParamList,'Value')};
%get stimulus value from user input
val = (get(hObject,'String'));
eval(['ex.targ.icon.' param_selected ' = str2num(val);']);
% --- Executes during object creation, after setting all properties.
function targIconVals_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function spatialAttention_Callback(hObject, eventdata, handles)
global ex
SA = get(hObject,'Value');
ex.exp.spatialAttention = SA;
function nInstructionTrials_Callback(hObject, eventdata, handles)
global ex
nInst = str2num(get(hObject,'String'));
ex.exp.nInstructionTrials = nInst;
% make sure that nInstructionTrials doesn't exceed blocksize
if ex.exp.nInstructionTrials>= ex.exp.nTrialsInBlock
ex.exp.nTrialsInBlock = ex.exp.nInstructionTrials + 1;
end
setGuiVariables(handles);
% --- Executes during object creation, after setting all properties.
function nInstructionTrials_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function sz_Callback(hObject, eventdata, handles)
global ex
ex.stim.vals.sz = str2num(get(hObject,'String'));
setGuiVariables(handles);
% --- Executes during object creation, after setting all properties.
function sz_CreateFcn(hObject, eventdata, handles)
% hObject handle to sz (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 button press in cornealReflexOff.
function cornealReflexOff_Callback(hObject, eventdata, handles)
% hObject handle to cornealReflexOff (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 cornealReflexOff