-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcrosscorfig.m
442 lines (322 loc) · 16.5 KB
/
crosscorfig.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
function varargout = crosscorfig(varargin)
% CROSSCORFIG Application M-file for crosscorfig.fig
% FIG = CROSSCORFIG launch crosscorfig GUI.
% CROSSCORFIG('callback_name', ...) invoke the named callback.
% Last Modified by GUIDE v2.5 28-Nov-2006 20:46:45
if nargin == 0 % LAUNCH GUI
fig = openfig(mfilename,'reuse');
% Generate a structure of handles to pass to callbacks, and store it.
handles = guihandles(fig);
guidata(fig, handles);
if nargout > 0
varargout{1} = fig;
end
elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK
try
if (nargout)
[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
else
feval(varargin{:}); % FEVAL switchyard
end
catch
disp(lasterr);
end
end
%| ABOUT CALLBACKS:
%| GUIDE automatically appends subfunction prototypes to this file, and
%| sets objects' callback properties to call them through the FEVAL
%| switchyard above. This comment describes that mechanism.
%|
%| Each callback subfunction declaration has the following form:
%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)
%|
%| The subfunction name is composed using the object's Tag and the
%| callback type separated by '_', e.g. 'slider2_Callback',
%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
%|
%| H is the callback object's handle (obtained using GCBO).
%|
%| EVENTDATA is empty, but reserved for future use.
%|
%| HANDLES is a structure containing handles of components in GUI using
%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
%| structure is created at GUI startup using GUIHANDLES and stored in
%| the figure's application data using GUIDATA. A copy of the structure
%| is passed to each callback. You can store additional information in
%| this structure at GUI startup, and you can change the structure
%| during callbacks. Call guidata(h, handles) after changing your
%| copy to replace the stored original so that subsequent callbacks see
%| the updates. Type "help guihandles" and "help guidata" for more
%| information.
%|
%| VARARGIN contains any extra arguments you have passed to the
%| callback. Specify the extra arguments by editing the callback
%| property in the inspector. By default, GUIDE sets the property to:
%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))
%| Add any extra arguments after the last argument, before the final
%| closing parenthesis.
% --------------------------------------------------------------------
function varargout = XCorRaw_ResizeFcn(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = CCPolyBox_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = CCIntBox_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = CCExport_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = CCLoadX_Callback(h, eventdata, handles, varargin)
crosscor('Load');
% --------------------------------------------------------------------
function varargout = CCBinWidth_Callback(h, eventdata, handles, varargin)
global xv
xv.BinWidth=str2num(get(h,'string'));
% --------------------------------------------------------------------
function varargout = CCWindow_Callback(h, eventdata, handles, varargin)
global xv
xv.Window=str2num(get(h,'string'));
% --------------------------------------------------------------------
function varargout = CCFromTime_Callback(h, eventdata, handles, varargin)
global xv
xv.FromTime=str2num(get(h,'string'));
% --------------------------------------------------------------------
function varargout = CCToTime_Callback(h, eventdata, handles, varargin)
global xv
xv.ToTime=str2num(get(h,'string'));
% --------------------------------------------------------------------
function varargout = CCStartTrial_Callback(h, eventdata, handles, varargin)
global xv
xv.StartTrial=str2num(get(h,'string'));
set(gh('ShuffleNumber'),'value',1); %so no illegal value is used when contents change
set(gh('ShuffleNumber'),'String',nums2strs(1:(xv.EndTrial-xv.StartTrial)));
set(gh('ShuffleNumber'),'value',xv.EndTrial-xv.StartTrial);
% --------------------------------------------------------------------
function varargout = CCEndTrial_Callback(h, eventdata, handles, varargin)
global xv
xv.EndTrial=str2num(get(h,'string'));
set(gh('ShuffleNumber'),'value',1); %so no illegal value is used when contents change
set(gh('ShuffleNumber'),'String',nums2strs(1:(xv.EndTrial-xv.StartTrial)));
set(gh('ShuffleNumber'),'value',xv.EndTrial-xv.StartTrial);
% --------------------------------------------------------------------
function varargout = Shuffle_Callback(h, eventdata, handles, varargin)
if (get(h,'Value')>1)
set(findobj('tag','ShuffleNumber'),'Enable','on')
set(findobj('tag','ShufflePValue'),'Enable','on')
else
set(findobj('tag','ShuffleNumber'),'Enable','off')
set(findobj('tag','ShufflePValue'),'Enable','off')
end
% --------------------------------------------------------------------
function varargout = ShuffleNumber_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = ShufflePValue_Callback(h, eventdata, handles, varargin)
global xv
if ~isempty(str2num(get(h,'string')))
if (str2num(get(h,'string'))>0 & str2num(get(h,'string'))<1)
xv.pValue=str2num(get(h,'string'));
else
set(h,'string',num2str(xv.pValue));
end
end
% --------------------------------------------------------------------
function varargout = CCFirstCell_Callback(h, eventdata, handles, varargin)
global xv
xv.firstunit=get(h,'Value');
% --------------------------------------------------------------------
function varargout = CCSecondCell_Callback(h, eventdata, handles, varargin)
global xv
xv.secondunit=get(h,'Value');
% --------------------------------------------------------------------
function varargout = CCAnalMenu_Callback(h, eventdata, handles, varargin)
v=get(h,'Value');
s=get(h,'String');
crosscor(s{v});
% --------------------------------------------------------------------
function varargout = CCExitButton_Callback(h, eventdata, handles, varargin)
clear xdata xv;
close;
% --------------------------------------------------------------------
function varargout = CCStartBin_Callback(h, eventdata, handles, varargin)
global xv;
xv.StartBin=get(h,'Value');
% --------------------------------------------------------------------
function varargout = CCEndBin_Callback(h, eventdata, handles, varargin)
global xv;
xv.EndBin=get(h,'Value');
% --------------------------------------------------------------------
function varargout = RatioValue_Callback(h, eventdata, handles, varargin)
% --- Executes on button press in CCSaveModel.
function CCSaveModel_Callback(hObject, eventdata, handles)
% hObject handle to CCSaveModel (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%FUNCTION DEFINITION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Converts array of numbers to a cell array of strings
function [cellout]=nums2strs(arrayin)
for n=1:length(arrayin)
cellout{n}=num2str(arrayin(n));
end
%End of function
%GH Gets Handle From Tag
function [handle] = gh(tag)
handle=findobj('Tag',tag);
%End of handle getting routine
% --- Executes during object creation, after setting all properties.
function ZAxisEdit_CreateFcn(hObject, eventdata, handles)
% hObject handle to ZAxisEdit (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function ZAxisEdit_Callback(hObject, eventdata, handles)
% hObject handle to ZAxisEdit (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 ZAxisEdit as text
% str2double(get(hObject,'String')) returns contents of ZAxisEdit as a double
% --- Executes on button press in AxisBox.
function AxisBox_Callback(hObject, eventdata, handles)
% hObject handle to AxisBox (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 AxisBox
% --- Executes on button press in ZAxisBox3.
function ZAxisBox3_Callback(hObject, eventdata, handles)
% hObject handle to ZAxisBox3 (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 ZAxisBox3
% --- Executes on selection change in TypeMenu.
function TypeMenu_Callback(hObject, eventdata, handles)
% hObject handle to TypeMenu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns TypeMenu contents as cell array
% contents{get(hObject,'Value')} returns selected item from TypeMenu
% --- Executes on selection change in CCHold1.
function CCHold1_Callback(hObject, eventdata, handles)
% hObject handle to CCHold1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns CCHold1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from CCHold1
% --- Executes during object creation, after setting all properties.
function CCHold1_CreateFcn(hObject, eventdata, handles)
% hObject handle to CCHold1 (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 on selection change in CCHold2.
function CCHold2_Callback(hObject, eventdata, handles)
% hObject handle to CCHold2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns CCHold2 contents as cell array
% contents{get(hObject,'Value')} returns selected item from CCHold2
% --- Executes during object creation, after setting all properties.
function CCHold2_CreateFcn(hObject, eventdata, handles)
% hObject handle to CCHold2 (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 on button press in CCWrapPSTH.
function CCWrapPSTH_Callback(hObject, eventdata, handles)
% hObject handle to CCWrapPSTH (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 CCWrapPSTH
% --- Executes on selection change in SmoothingMenu.
function SmoothingMenu_Callback(hObject, eventdata, handles)
% hObject handle to SmoothingMenu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns SmoothingMenu contents as cell array
% contents{get(hObject,'Value')} returns selected item from SmoothingMenu
global SmoothType;
contents = get(hObject,'String');
SmoothType=contents{get(hObject,'Value')};
function CCGauss1_Callback(hObject, eventdata, handles)
% hObject handle to CCGauss1 (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 CCGauss1 as text
% str2double(get(hObject,'String')) returns contents of CCGauss1 as a double
% --- Executes during object creation, after setting all properties.
function CCGauss1_CreateFcn(hObject, eventdata, handles)
% hObject handle to CCGauss1 (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 CCGauss2_Callback(hObject, eventdata, handles)
% hObject handle to CCGauss2 (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 CCGauss2 as text
% str2double(get(hObject,'String')) returns contents of CCGauss2 as a double
% --- Executes during object creation, after setting all properties.
function CCGauss2_CreateFcn(hObject, eventdata, handles)
% hObject handle to CCGauss2 (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 CCGauss3_Callback(hObject, eventdata, handles)
% hObject handle to CCGauss3 (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 CCGauss3 as text
% str2double(get(hObject,'String')) returns contents of CCGauss3 as a double
% --- Executes during object creation, after setting all properties.
function CCGauss3_CreateFcn(hObject, eventdata, handles)
% hObject handle to CCGauss3 (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 CCGauss4_Callback(hObject, eventdata, handles)
% hObject handle to CCGauss4 (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 CCGauss4 as text
% str2double(get(hObject,'String')) returns contents of CCGauss4 as a double
% --- Executes during object creation, after setting all properties.
function CCGauss4_CreateFcn(hObject, eventdata, handles)
% hObject handle to CCGauss4 (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 CCGauss3Lock.
function CCGauss3Lock_Callback(hObject, eventdata, handles)
% hObject handle to CCGauss3Lock (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 CCGauss3Lock