function Fixed_duration_task_GUI(varargin)
fh = figure('Visible','off', ...
'HandleVisibility','callback', ...
'NumberTitle','off', ... % turns off MATLAB GUI window title
'Name','Fixed_duration_task_GUI', ... % now, define my own
'Units','normalized', ...
'Position',[1.000000e-001 1.000000e-001 6.000000e-001 6.000000e-001], ...
'Color','white', ... % match bg of MODE_new.jpg
'Resize','off');
set(fh,'MenuBar','none'); % removes MATLAB default menu bar
x0 = 0.1; y0 = 0.85;
x0run = 0.825; y0run = 0.075; % lower-left corner coord. of the run button
dxst1 = 0.075; dyst1 = 0.05; % for static text 1
dxet1 = 0.100; dyet1 = 0.05; % for edit text 1
dxst2 = 0.400; dyst2 = 0.10; % for static text 2
dxpb1 = 0.050; dypb1 = 0.05; % for PDF logo pushbuttons
dxrun = 0.100; dyrun = 0.075; % for "Run" pushbutton
% First, create a Heading for the secondary GUI with a static text box
dx = 0.6; dy = 0.125;
st0h = uicontrol(fh, ...
'style','text', ...
'String',['Lateral intraparietal area' char(10) '(Eq. 34, p. 1370: Grossberg & Pilly (2008))'], ...
'Units','normalized', ...
'Position',[x0,y0,dx,dy], ...
'FontSize',12, ...
'FontWeight','bold');
% Create static box, edit box, static box, logo (that points to a doc; optional)
y0 = y0 - dy*1.05; space = dxst1*0.20;
data.str{1} = 'A9';
data.default{1} = 4.500000;
st1h(1) = uicontrol(fh,'style','text', ...
'String','A9', ...
'Units','normalized', ...
'Position',[x0,y0,dxst1,dyst1], ...
'FontSize',10, ...
'FontWeight','bold');
et1h(1) = uicontrol(fh,'Style','edit', ...
'String','4.5', ...
'Units','normalized', ...
'Position',[x0+dxst1+space,y0,dxet1,dyet1], ...
'FontSize',10, ...
'FontWeight','normal', ...
'callback',{@edit1_Callback 'A9'});
st2h(1) = uicontrol(fh,'style','text', ...
'String','Parameter that ...', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+space*2,y0-0.02,dxst2,dyst2], ...
'FontSize',10, ...
'FontWeight','bold');
pb1h(1) = uicontrol(fh,'Style','pushbutton', ...
'String','PDF', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+dxst2+space*3,y0,dxpb1,dypb1], ...
'FontSize',10, ...
'FontWeight','bold', ...
'callback',{@opendoc1_Callback 'A9_heur.pdf'});
y0 = y0 - max([dyst1 dyst2 dyet1 dypb1])*1.1;
data.str{2} = 'g_f';
data.default{2} = 2.000000;
st1h(2) = uicontrol(fh,'style','text', ...
'String','g_f', ...
'Units','normalized', ...
'Position',[x0,y0,dxst1,dyst1], ...
'FontSize',10, ...
'FontWeight','bold');
et1h(2) = uicontrol(fh,'Style','edit', ...
'String','2', ...
'Units','normalized', ...
'Position',[x0+dxst1+space,y0,dxet1,dyet1], ...
'FontSize',10, ...
'FontWeight','normal', ...
'callback',{@edit1_Callback 'g_f'});
st2h(2) = uicontrol(fh,'style','text', ...
'String','Gain of recurrent self-excitation ...', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+space*2,y0-0.02,dxst2,dyst2], ...
'FontSize',10, ...
'FontWeight','bold');
pb1h(2) = uicontrol(fh,'Style','pushbutton', ...
'String','PDF', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+dxst2+space*3,y0,dxpb1,dypb1], ...
'FontSize',10, ...
'FontWeight','bold', ...
'callback',{@opendoc1_Callback 'g_f_heur.pdf'});
y0 = y0 - max([dyst1 dyst2 dyet1 dypb1])*1.1;
data.str{3} = 'g_h';
data.default{3} = 5.000000;
st1h(3) = uicontrol(fh,'style','text', ...
'String','g_h', ...
'Units','normalized', ...
'Position',[x0,y0,dxst1,dyst1], ...
'FontSize',10, ...
'FontWeight','bold');
et1h(3) = uicontrol(fh,'Style','edit', ...
'String','5', ...
'Units','normalized', ...
'Position',[x0+dxst1+space,y0,dxet1,dyet1], ...
'FontSize',10, ...
'FontWeight','normal', ...
'callback',{@edit1_Callback 'g_h'});
st2h(3) = uicontrol(fh,'style','text', ...
'String','Gain of recurrent inhibition ...', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+space*2,y0-0.02,dxst2,dyst2], ...
'FontSize',10, ...
'FontWeight','bold');
pb1h(3) = uicontrol(fh,'Style','pushbutton', ...
'String','PDF', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+dxst2+space*3,y0,dxpb1,dypb1], ...
'FontSize',10, ...
'FontWeight','bold', ...
'callback',{@opendoc1_Callback 'g_h_heur.pdf'});
y0 = y0 - max([dyst1 dyst2 dyet1 dypb1])*1.1;
data.str{4} = 'lambda';
data.default{4} = 5.000000;
st1h(4) = uicontrol(fh,'style','text', ...
'String','lambda', ...
'Units','normalized', ...
'Position',[x0,y0,dxst1,dyst1], ...
'FontSize',10, ...
'FontWeight','bold');
et1h(4) = uicontrol(fh,'Style','edit', ...
'String','5', ...
'Units','normalized', ...
'Position',[x0+dxst1+space,y0,dxet1,dyet1], ...
'FontSize',10, ...
'FontWeight','normal', ...
'callback',{@edit1_Callback 'lambda'});
st2h(4) = uicontrol(fh,'style','text', ...
'String','Gain of bottom-up excitation ...', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+space*2,y0-0.02,dxst2,dyst2], ...
'FontSize',10, ...
'FontWeight','bold');
pb1h(4) = uicontrol(fh,'Style','pushbutton', ...
'String','PDF', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+dxst2+space*3,y0,dxpb1,dypb1], ...
'FontSize',10, ...
'FontWeight','bold', ...
'callback',{@opendoc1_Callback 'lambda_heur.pdf'});
y0 = y0 - max([dyst1 dyst2 dyet1 dypb1])*1.1;
data.str{5} = 'sigLIP';
data.default{5} = 5.000000;
st1h(5) = uicontrol(fh,'style','text', ...
'String','sigLIP', ...
'Units','normalized', ...
'Position',[x0,y0,dxst1,dyst1], ...
'FontSize',10, ...
'FontWeight','bold');
et1h(5) = uicontrol(fh,'Style','edit', ...
'String','5', ...
'Units','normalized', ...
'Position',[x0+dxst1+space,y0,dxet1,dyet1], ...
'FontSize',10, ...
'FontWeight','normal', ...
'callback',{@edit1_Callback 'sigLIP'});
st2h(5) = uicontrol(fh,'style','text', ...
'String','Gain of recurrent ...', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+space*2,y0-0.02,dxst2,dyst2], ...
'FontSize',10, ...
'FontWeight','bold');
pb1h(5) = uicontrol(fh,'Style','pushbutton', ...
'String','PDF', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+dxst2+space*3,y0,dxpb1,dypb1], ...
'FontSize',10, ...
'FontWeight','bold', ...
'callback',{@opendoc1_Callback 'sigLIP_heur.pdf'});
y0 = y0 - max([dyst1 dyst2 dyet1 dypb1])*1.1;
data.str{6} = 'g_delay';
data.default{6} = 9.000000;
st1h(6) = uicontrol(fh,'style','text', ...
'String','g_delay', ...
'Units','normalized', ...
'Position',[x0,y0,dxst1,dyst1], ...
'FontSize',10, ...
'FontWeight','bold');
et1h(6) = uicontrol(fh,'Style','edit', ...
'String','9', ...
'Units','normalized', ...
'Position',[x0+dxst1+space,y0,dxet1,dyet1], ...
'FontSize',10, ...
'FontWeight','normal', ...
'callback',{@edit1_Callback 'g_delay'});
st2h(6) = uicontrol(fh,'style','text', ...
'String','Threshold LIP ...', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+space*2,y0-0.02,dxst2,dyst2], ...
'FontSize',10, ...
'FontWeight','bold');
pb1h(6) = uicontrol(fh,'Style','pushbutton', ...
'String','PDF', ...
'Units','normalized', ...
'Position',[x0+dxst1+dxet1+dxst2+space*3,y0,dxpb1,dypb1], ...
'FontSize',10, ...
'FontWeight','bold', ...
'callback',{@opendoc1_Callback 'g_delay_heur.pdf'});
y0 = y0 - max([dyst1 dyst2 dyet1 dypb1])*1.1;
% save the edit text handles to data
data.et1h = et1h(1:end);
for i=1:6
eval(['data.' data.str{i} '= data.default{i};']);
end
data.guiName = 'Fixed_duration_task_GUI';
setappdata(fh, 'myData', data);
%align(st0h,'HorizontalAlignment','center');
st3h = uicontrol(fh,'style','text', ...
'String','After changing each parameter, press "Enter".', ...
'Units','normalized', ...
'Position',[0.05,0.08,0.60,0.05], ...
'HorizontalAlignment','Left', ...
'foregroundColor',[1 0 0], ...
'FontSize',10, ...
'FontWeight','bold');
st4h = uicontrol(fh,'style','text', ...
'String','To see each parameter heuristic, please click on the PDF logo.', ...
'Units','normalized', ...
'Position',[0.05,0.02,0.60,0.05], ...
'HorizontalAlignment','Left', ...
'foregroundColor',[1 0 0], ...
'FontSize',10, ...
'FontWeight','bold');
runh = uicontrol(fh,'Style','pushbutton', ...
'String','RUN', ...
'Units','normalized', ...
'Position',[x0run,y0run,dxrun,dyrun], ...
'FontSize',12, ...
'FontWeight','bold', ...
'callback',{@run1_Callback 'FDtasknew(A9,g_f,g_h,lambda,sigLIP,g_delay)'});
PDFbuttons(pb1h);
etbgcolor = get(et1h(1),'BackgroundColor');
set(fh,'Color',etbgcolor);
set(fh,'Visible','on');
function opendoc1_Callback(hObject,eventdata,varargin)
% hObject handle to Exit_menu_item (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
open(varargin{1});
function edit1_Callback(hObject, eventdata, varargin)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
fh = get(hObject,'parent');
data = getappdata(fh, 'myData');
value = str2num(get(hObject,'String'));
eval(['data.' varargin{1} '= value;']);
setappdata(fh,'myData',data);
function run1_Callback(hObject, eventdata, varargin)
% hObject handle to run1_Callback
% eventdata reserved - to be defined in a future version of MATLAB
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
fh = get(hObject,'parent');
data = getappdata(fh, 'myData');
for i=1:length(data.str)
eval([data.str{i} '= data.' data.str{i} ';']); % e.g., A9 = data.A9;
end
% Prevent user from changing the contents of edit boxes
editBoxEnable2(data,'Off');
old_color=get(hObject,'BackgroundColor'); % save original button color
set(hObject, 'BackgroundColor', [1 0 0]); % Change button color
set(hObject, 'String', 'running ...');
% open('RTcaption.pdf');
drawnow % to make sure that the "Run" button change color right away
eval(varargin{1}) % run the m-file specified by varargin{1}
set(hObject, 'String', 'Run');
set(hObject, 'BackgroundColor', old_color);
editBoxEnable2(data,'On');