ET_PDToolkit/PDToolkit/GUI/PDTrialGUI.m

2043 lines
82 KiB
Matlab

function varargout = PDTrialGUI(varargin)
% PDTRIALGUI MATLAB code for PDTrialGUI.fig
% PDTRIALGUI, by itself, creates a new PDTRIALGUI or raises the existing
% singleton*.
%
% H = PDTRIALGUI returns the handle to a new PDTRIALGUI or the handle to
% the existing singleton*.
%
% PDTRIALGUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PDTRIALGUI.M with the given input arguments.
%
% PDTRIALGUI('Property','Value',...) creates a new PDTRIALGUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before PDTrialGUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to PDTrialGUI_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 PDTrialGUI
% Last Modified by GUIDE v2.5 25-Feb-2016 20:40:31
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @PDTrialGUI_OpeningFcn, ...
'gui_OutputFcn', @PDTrialGUI_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 PDTrialGUI is made visible.
function PDTrialGUI_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 PDTrialGUI (see VARARGIN)
% Choose default command line output for PDTrialGUI
handles.output = hObject;
screen_to_show = 'baseline';
if nargin > 4
settings = varargin{1};
screen_to_show = varargin{2};
end
fieldnames = { 'trial_start_pattern', 'trial_end_pattern', ...
'stimulus_onset_pattern', 'stimulus_offset_pattern', ...
'baseline_onset_pattern', 'baseline_offset_pattern', ...
'label_patterns'};
settings = PDSettings;
settings.dependencies = struct;
for f = 1:length(fieldnames)
settings.dependencies = setfield(settings.dependencies, fieldnames{f},[]);
end
if nargin < 5
handles.settings = struct('baseline', [], 'baseline_type',[], ...
'stimulus', [], ...
'trial', [], ...
'labels', []);
else
handles.settings = settings;
end
% Update handles structure
guidata(hObject, handles);
%% populate the popups
popup_items = {'Trial Start', 'Trial End', 'Baseline Start', 'Baseline End', 'Stimulus Start', 'Stimulus End', 'Label'};
handles.baseline_start_dependent_popup.String = popup_items([1:2 4:end]);
handles.baseline_end_dependent_popup.String = popup_items([1:3 5:end]);
handles.stimulus_start_dependent_popup.String = popup_items([1:4 6:end]);
handles.stimulus_end_dependent_popup.String = popup_items([1:5 7:end]);
handles.trial_start_dependent_popup.String = popup_items([2:end]);
handles.trial_end_dependent_popup.String = popup_items([1 3:end]);
types = {'Normal', 'Deconvolution'};
handles.labeltype_popup.String = types;
populate_label_listbox(hObject, handles);
%% activate the screen
switch screen_to_show
case 'baseline'
handles.main_menu.Value = 1;
display('1::')
case 'trial'
handles.main_menu.Value = 2;
display('2::')
case 'stimulus'
handles.main_menu.Value = 3;
display('3::')
case 'label'
handles.main_menu.Value = 4;
display('4::')
end
% UIWAIT makes PDTrialGUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = PDTrialGUI_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 button press in baseline_per_session_radio.
function baseline_per_session_radio_Callback(hObject, eventdata, handles)
% hObject handle to baseline_per_session_radio (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 baseline_per_session_radio
handles.baseline_per_trial_radio.Value = ~get(hObject, 'Value');
if get(hObject, 'Value')
handles.settings.baseline_type = 'per trial';
else
handles.settings.baseline_type = 'per session';
end
guidata(hObject, handles);
% --- Executes on button press in baseline_per_trial_radio.
function baseline_per_trial_radio_Callback(hObject, eventdata, handles)
% hObject handle to baseline_per_trial_radio (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 baseline_per_trial_radio
handles.baseline_per_session_radio.Value = ~get(hObject, 'Value');
if get(hObject, 'Value')
handles.settings.baseline_type = 'per trial';
else
handles.settings.baseline_type = 'per session';
end
guidata(hObject, handles);
% --- Executes on button press in dependent_baseline_end_check.
function dependent_baseline_end_check_Callback(hObject, eventdata, handles)
% hObject handle to dependent_baseline_end_check (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 dependent_baseline_end_check
if get(hObject, 'Value')
handles.baseline_end_dependent_popup.Enable = 'on';
handles.baseline_end_reltime_text.Enable = 'on';
handles.baseline_end_text.Enable = 'off';
else
handles.baseline_end_dependent_popup.Enable = 'off';
handles.baseline_end_reltime_text.Enable = 'off';
handles.baseline_end_text.Enable = 'on';
end
function baseline_start_text_Callback(hObject, eventdata, handles)
% hObject handle to baseline_start_text (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 baseline_start_text as text
% str2double(get(hObject,'String')) returns contents of baseline_start_text as a double
handles.settings.baseline_onset_pattern = get(hObject, 'String');
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function baseline_start_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to baseline_start_text (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 baseline_end_text_Callback(hObject, eventdata, handles)
% hObject handle to baseline_end_text (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 baseline_end_text as text
% str2double(get(hObject,'String')) returns contents of baseline_end_text as a double
handles.settings.baseline_offset_pattern = get(hObject, 'String');
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function baseline_end_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to baseline_end_text (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 selection change in main_menu.
function main_menu_Callback(hObject, eventdata, handles)
% hObject handle to main_menu (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 main_menu contents as cell array
% contents{get(hObject,'Value')} returns selected item from main_menu
contents = cellstr(get(hObject,'String'));
selected = get(hObject,'Value');
posx = 30; posy = 4.6;
switch selected
case 1 % baseline form
display('1');
handles.baseline_panel
handles.baseline_panel.Position(2) = posy;
handles.baseline_panel.Visible = 'on';
handles.stimulus_panel.Visible = 'off';
handles.trial_panel.Visible = 'off';
handles.label_panel.Visible = 'off';
case 2 % trial form
display('2');
handles.trial_panel.Position(1) = posx;
handles.trial_panel.Position(2) = posy;
handles.baseline_panel.Visible = 'off';
handles.stimulus_panel.Visible = 'off';
handles.label_panel.Visible = 'off';
handles.trial_panel.Visible = 'on';
case 3 % stimulus form
display('3');
handles.stimulus_panel.Position(1) = posx;
handles.stimulus_panel.Position(2) = posy;
handles.baseline_panel.Visible = 'off';
handles.trial_panel.Visible = 'off';
handles.label_panel.Visible = 'off';
handles.stimulus_panel.Visible = 'on';
case 4 % labels
display('4');
handles.label_panel.Position(1) = posx;
handles.label_panel.Position(2) = posy;
handles.baseline_panel.Visible = 'off';
handles.stimulus_panel.Visible = 'off';
handles.trial_panel.Visible = 'off';
handles.label_panel.Visible = 'on';
end
% --- Executes during object creation, after setting all properties.
function main_menu_CreateFcn(hObject, eventdata, handles)
% hObject handle to main_menu (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 baseline_end_dependent_popup.
function baseline_end_dependent_popup_Callback(hObject, eventdata, handles)
% hObject handle to baseline_end_dependent_popup (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 baseline_end_dependent_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from baseline_end_dependent_popup
contents = cellstr(get(hObject,'String'));
handles.settings.dependencies.baseline_end = { contents{get(hObject,'Value')} 0} ;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function baseline_end_dependent_popup_CreateFcn(hObject, eventdata, handles)
% hObject handle to baseline_end_dependent_popup (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
function baseline_end_reltime_text_Callback(hObject, eventdata, handles)
% hObject handle to baseline_end_reltime_text (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 baseline_end_reltime_text as text
% str2double(get(hObject,'String')) returns contents of baseline_end_reltime_text as a double
contents = cellstr(get(hObject,'String'));
rel_time = str2double(contents);
if isnan(rel_time)
msgbox('Error: could not parse relative time');
rel_time = 0;
handles.baseline_end_reltime_text.String = '0';
else
handles.settings.dependencies.baseline_end = { contents{get(hObject,'String')} rel_time} ;
end
% --- Executes during object creation, after setting all properties.
function baseline_end_reltime_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to baseline_end_reltime_text (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 checkbox3
function checkbox3_Callback(hObject, eventdata, handles)
% hObject handle to checkbox3 (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 checkbox3
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (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 edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double
% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (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 edit8_Callback(hObject, eventdata, handles)
% hObject handle to edit8 (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 edit8 as text
% str2double(get(hObject,'String')) returns contents of edit8 as a double
% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (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 selection change in popupmenu3.
function popupmenu3_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu3 (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 popupmenu3 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu3
% --- Executes during object creation, after setting all properties.
function popupmenu3_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu3 (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
function edit9_Callback(hObject, eventdata, handles)
% hObject handle to edit9 (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 edit9 as text
% str2double(get(hObject,'String')) returns contents of edit9 as a double
% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit9 (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 checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)
% hObject handle to checkbox2 (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 checkbox2
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (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 edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (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 edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (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 edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (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 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
% --- 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
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (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 edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (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 selection change in label_list.
function label_list_Callback(hObject, eventdata, handles)
% hObject handle to label_list (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 label_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from label_list
% --- Executes during object creation, after setting all properties.
function label_list_CreateFcn(hObject, eventdata, handles)
% hObject handle to label_list (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 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)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in checkbox4.
function checkbox4_Callback(hObject, eventdata, handles)
% hObject handle to checkbox4 (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 checkbox4
% --- Executes on selection change in popupmenu4.
function popupmenu4_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu4 (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 popupmenu4 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu4
% --- Executes during object creation, after setting all properties.
function popupmenu4_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu4 (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
function edit10_Callback(hObject, eventdata, handles)
% hObject handle to edit10 (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 edit10 as text
% str2double(get(hObject,'String')) returns contents of edit10 as a double
% --- Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit10 (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 edit11_Callback(hObject, eventdata, handles)
% hObject handle to edit11 (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 edit11 as text
% str2double(get(hObject,'String')) returns contents of edit11 as a double
% --- Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (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 pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in load_settings_from_experiment.
function load_settings_from_experiment_Callback(hObject, eventdata, handles)
% hObject handle to load_settings_from_experiment (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename,path,FilterIndex] = uigetfile({'*_PDExp.mat'; '*_PDSettings.mat'},'Select a PD Experiment file');
load([path filesep filename]);
if FilterIndex == 1
settings = e.settings;
end
% --- Executes on button press in dependent_baseline_start_check.
function dependent_baseline_start_check_Callback(hObject, eventdata, handles)
% hObject handle to dependent_baseline_start_check (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 dependent_baseline_start_check
if get(hObject, 'Value')
handles.baseline_start_dependent_popup.Enable = 'on';
handles.baseline_start_reltime_text.Enable = 'on';
handles.baseline_start_text.Enable = 'off';
else
handles.baseline_start_dependent_popup.Enable = 'off';
handles.baseline_start_reltime_text.Enable = 'off';
handles.baseline_start_text.Enable = 'on';
end
% --- Executes on selection change in baseline_start_dependent_popup.
function baseline_start_dependent_popup_Callback(hObject, eventdata, handles)
% hObject handle to baseline_start_dependent_popup (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 baseline_start_dependent_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from baseline_start_dependent_popup
contents = cellstr(get(hObject,'String'));
handles.settings.dependencies.baseline_start = { contents{get(hObject,'Value')} 0} ;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function baseline_start_dependent_popup_CreateFcn(hObject, eventdata, handles)
% hObject handle to baseline_start_dependent_popup (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
function baseline_start_reltime_text_Callback(hObject, eventdata, handles)
% hObject handle to baseline_start_reltime_text (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 baseline_start_reltime_text as text
% str2double(get(hObject,'String')) returns contents of baseline_start_reltime_text as a double
contents = cellstr(get(hObject,'String'));
rel_time = str2double(contents);
if isnan(rel_time)
msgbox('Error: could not parse relative time');
rel_time = 0;
handles.baseline_start_reltime_text.String = '0';
else
handles.settings.dependencies.baseline_start{2} = rel_time;
end
% --- Executes during object creation, after setting all properties.
function baseline_start_reltime_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to baseline_start_reltime_text (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 radiobutton3.
function radiobutton3_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton3 (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 radiobutton3
% --- Executes on button press in radiobutton4.
function radiobutton4_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton4 (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 radiobutton4
% --- Executes on button press in checkbox6.
function checkbox6_Callback(hObject, eventdata, handles)
% hObject handle to checkbox6 (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 checkbox6
function edit13_Callback(hObject, eventdata, handles)
% hObject handle to edit13 (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 edit13 as text
% str2double(get(hObject,'String')) returns contents of edit13 as a double
% --- Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit13 (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 edit14_Callback(hObject, eventdata, handles)
% hObject handle to edit14 (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 edit14 as text
% str2double(get(hObject,'String')) returns contents of edit14 as a double
% --- Executes during object creation, after setting all properties.
function edit14_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit14 (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 selection change in popupmenu6.
function popupmenu6_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu6 (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 popupmenu6 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu6
% --- Executes during object creation, after setting all properties.
function popupmenu6_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu6 (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
function edit15_Callback(hObject, eventdata, handles)
% hObject handle to edit15 (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 edit15 as text
% str2double(get(hObject,'String')) returns contents of edit15 as a double
% --- Executes during object creation, after setting all properties.
function edit15_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit15 (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 checkbox7.
function checkbox7_Callback(hObject, eventdata, handles)
% hObject handle to checkbox7 (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 checkbox7
% --- Executes on selection change in popupmenu7.
function popupmenu7_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu7 (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 popupmenu7 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu7
% --- Executes during object creation, after setting all properties.
function popupmenu7_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu7 (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
function edit16_Callback(hObject, eventdata, handles)
% hObject handle to edit16 (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 edit16 as text
% str2double(get(hObject,'String')) returns contents of edit16 as a double
% --- Executes during object creation, after setting all properties.
function edit16_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit16 (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 dependent_trial_end_check.
function dependent_trial_end_check_Callback(hObject, eventdata, handles)
% hObject handle to dependent_trial_end_check (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 dependent_trial_end_check
if get(hObject, 'Value')
handles.trial_end_dependent_popup.Enable = 'on';
handles.trial_end_reltime_text.Enable = 'on';
handles.trial_end_text.Enable = 'off';
else
handles.trial_end_dependent_popup.Enable = 'off';
handles.trial_end_reltime_text.Enable = 'off';
handles.trial_end_text.Enable = 'on';
end
function trial_start_text_Callback(hObject, eventdata, handles)
% hObject handle to trial_start_text (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 trial_start_text as text
% str2double(get(hObject,'String')) returns contents of trial_start_text as a double
handles.settings.trial_start_pattern = get(hObject, 'String');
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function trial_start_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to trial_start_text (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 trial_end_text_Callback(hObject, eventdata, handles)
% hObject handle to trial_end_text (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 trial_end_text as text
% str2double(get(hObject,'String')) returns contents of trial_end_text as a double
handles.settings.trial_end_pattern = get(hObject, 'String');
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function trial_end_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to trial_end_text (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 selection change in trial_end_dependent_popup.
function trial_end_dependent_popup_Callback(hObject, eventdata, handles)
% hObject handle to trial_end_dependent_popup (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 trial_end_dependent_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from trial_end_dependent_popup
contents = cellstr(get(hObject,'String'));
handles.settings.dependencies.trial_end = { contents{get(hObject,'Value')} 0} ;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function trial_end_dependent_popup_CreateFcn(hObject, eventdata, handles)
% hObject handle to trial_end_dependent_popup (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
function trial_end_reltime_text_Callback(hObject, eventdata, handles)
% hObject handle to trial_end_reltime_text (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 trial_end_reltime_text as text
% str2double(get(hObject,'String')) returns contents of trial_end_reltime_text as a double
% --- Executes during object creation, after setting all properties.
function trial_end_reltime_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to trial_end_reltime_text (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 dependent_trial_start_check.
function dependent_trial_start_check_Callback(hObject, eventdata, handles)
% hObject handle to dependent_trial_start_check (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 dependent_trial_start_check
if get(hObject, 'Value')
handles.trial_start_dependent_popup.Enable = 'on';
handles.trial_start_reltime_text.Enable = 'on';
handles.trial_start_text.Enable = 'off';
else
handles.trial_start_dependent_popup.Enable = 'off';
handles.trial_start_reltime_text.Enable = 'off';
handles.trial_start_text.Enable = 'on';
end
% --- Executes on selection change in trial_start_dependent_popup.
function trial_start_dependent_popup_Callback(hObject, eventdata, handles)
% hObject handle to trial_start_dependent_popup (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 trial_start_dependent_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from trial_start_dependent_popup
contents = cellstr(get(hObject,'String'));
handles.settings.dependencies.trial_start = { contents{get(hObject,'Value')} 0} ;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function trial_start_dependent_popup_CreateFcn(hObject, eventdata, handles)
% hObject handle to trial_start_dependent_popup (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
function trial_start_reltime_text_Callback(hObject, eventdata, handles)
% hObject handle to trial_start_reltime_text (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 trial_start_reltime_text as text
% str2double(get(hObject,'String')) returns contents of trial_start_reltime_text as a double
% --- Executes during object creation, after setting all properties.
function trial_start_reltime_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to trial_start_reltime_text (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 checkbox10.
function checkbox10_Callback(hObject, eventdata, handles)
% hObject handle to checkbox10 (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 checkbox10
function edit21_Callback(hObject, eventdata, handles)
% hObject handle to edit21 (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 edit21 as text
% str2double(get(hObject,'String')) returns contents of edit21 as a double
% --- Executes during object creation, after setting all properties.
function edit21_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit21 (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 edit22_Callback(hObject, eventdata, handles)
% hObject handle to edit22 (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 edit22 as text
% str2double(get(hObject,'String')) returns contents of edit22 as a double
% --- Executes during object creation, after setting all properties.
function edit22_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit22 (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 selection change in popupmenu10.
function popupmenu10_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu10 (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 popupmenu10 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu10
% --- Executes during object creation, after setting all properties.
function popupmenu10_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu10 (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
function edit23_Callback(hObject, eventdata, handles)
% hObject handle to edit23 (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 edit23 as text
% str2double(get(hObject,'String')) returns contents of edit23 as a double
% --- Executes during object creation, after setting all properties.
function edit23_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit23 (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 checkbox11.
function checkbox11_Callback(hObject, eventdata, handles)
% hObject handle to checkbox11 (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 checkbox11
% --- Executes on selection change in popupmenu11.
function popupmenu11_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu11 (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 popupmenu11 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu11
% --- Executes during object creation, after setting all properties.
function popupmenu11_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu11 (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
function edit24_Callback(hObject, eventdata, handles)
% hObject handle to edit24 (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 edit24 as text
% str2double(get(hObject,'String')) returns contents of edit24 as a double
% --- Executes during object creation, after setting all properties.
function edit24_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit24 (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 checkbox12.
function checkbox12_Callback(hObject, eventdata, handles)
% hObject handle to checkbox12 (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 checkbox12
function edit25_Callback(hObject, eventdata, handles)
% hObject handle to edit25 (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 edit25 as text
% str2double(get(hObject,'String')) returns contents of edit25 as a double
% --- Executes during object creation, after setting all properties.
function edit25_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit25 (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 edit26_Callback(hObject, eventdata, handles)
% hObject handle to edit26 (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 edit26 as text
% str2double(get(hObject,'String')) returns contents of edit26 as a double
% --- Executes during object creation, after setting all properties.
function edit26_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit26 (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 selection change in popupmenu12.
function popupmenu12_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu12 (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 popupmenu12 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu12
% --- Executes during object creation, after setting all properties.
function popupmenu12_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu12 (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
function edit27_Callback(hObject, eventdata, handles)
% hObject handle to edit27 (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 edit27 as text
% str2double(get(hObject,'String')) returns contents of edit27 as a double
% --- Executes during object creation, after setting all properties.
function edit27_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit27 (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 checkbox13.
function checkbox13_Callback(hObject, eventdata, handles)
% hObject handle to checkbox13 (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 checkbox13
% --- Executes on selection change in popupmenu13.
function popupmenu13_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu13 (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 popupmenu13 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu13
% --- Executes during object creation, after setting all properties.
function popupmenu13_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu13 (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
function edit28_Callback(hObject, eventdata, handles)
% hObject handle to edit28 (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 edit28 as text
% str2double(get(hObject,'String')) returns contents of edit28 as a double
% --- Executes during object creation, after setting all properties.
function edit28_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit28 (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 dependent_stim_end_check.
function dependent_stim_end_check_Callback(hObject, eventdata, handles)
% hObject handle to dependent_stim_end_check (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 dependent_stim_end_check
if get(hObject, 'Value')
handles.stimulus_end_dependent_popup.Enable = 'on';
handles.stimulus_end_reltime_text.Enable = 'on';
handles.stimulus_end_text.Enable = 'off';
else
handles.stimulus_end_dependent_popup.Enable = 'off';
handles.baseline_end_reltime_text.Enable = 'off';
handles.stimulus_end_text.Enable = 'on';
end
function stimulus_start_text_Callback(hObject, eventdata, handles)
% hObject handle to stimulus_start_text (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 stimulus_start_text as text
% str2double(get(hObject,'String')) returns contents of stimulus_start_text as a double
handles.settings.stimulus_onset_pattern = get(hObject, 'String');
% --- Executes during object creation, after setting all properties.
function stimulus_start_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to stimulus_start_text (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 stimulus_end_text_Callback(hObject, eventdata, handles)
% hObject handle to stimulus_end_text (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 stimulus_end_text as text
% str2double(get(hObject,'String')) returns contents of stimulus_end_text as a double
handles.settings.stimulus_offset_pattern = get(hObject, 'String');
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function stimulus_end_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to stimulus_end_text (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 selection change in stimulus_end_dependent_popup.
function stimulus_end_dependent_popup_Callback(hObject, eventdata, handles)
% hObject handle to stimulus_end_dependent_popup (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 stimulus_end_dependent_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from stimulus_end_dependent_popup
contents = cellstr(get(hObject,'String'));
handles.settings.dependencies.stimulus_onset = { contents{get(hObject,'Value')} 0} ;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function stimulus_end_dependent_popup_CreateFcn(hObject, eventdata, handles)
% hObject handle to stimulus_end_dependent_popup (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
function stimulus_end_reltime_text_Callback(hObject, eventdata, handles)
% hObject handle to stimulus_end_reltime_text (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 stimulus_end_reltime_text as text
% str2double(get(hObject,'String')) returns contents of stimulus_end_reltime_text as a double
contents = cellstr(get(hObject,'String'));
rel_time = str2double(contents);
if isnan(rel_time)
msgbox('Error: could not parse relative time');
rel_time = 0;
handles.stimulus_end_reltime_text.String = '0';
else
handles.settings.dependencies.stimulus_end = { contents{get(hObject,'Value')} rel_time} ;
end
% --- Executes during object creation, after setting all properties.
function stimulus_end_reltime_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to stimulus_end_reltime_text (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 dependent_stim_start_check.
function dependent_stim_start_check_Callback(hObject, eventdata, handles)
% hObject handle to dependent_stim_start_check (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 dependent_stim_start_check
if get(hObject, 'Value')
handles.stimulus_start_dependent_popup.Enable = 'on';
handles.stimulus_start_reltime_text.Enable = 'on';
handles.stimulus_start_text.Enable = 'off';
else
handles.stimulus_start_dependent_popup.Enable = 'off';
handles.stimulus_start_reltime_text.Enable = 'off';
handles.stimulus_start_text.Enable = 'on';
end
% --- Executes on selection change in stimulus_start_dependent_popup.
function stimulus_start_dependent_popup_Callback(hObject, eventdata, handles)
% hObject handle to stimulus_start_dependent_popup (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 stimulus_start_dependent_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from stimulus_start_dependent_popup
contents = cellstr(get(hObject,'String'));
handles.settings.dependencies.stimulus_onset = { contents{get(hObject,'Value')} 0} ;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function stimulus_start_dependent_popup_CreateFcn(hObject, eventdata, handles)
% hObject handle to stimulus_start_dependent_popup (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
function stimulus_start_reltime_text_Callback(hObject, eventdata, handles)
% hObject handle to stimulus_start_reltime_text (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 stimulus_start_reltime_text as text
% str2double(get(hObject,'String')) returns contents of stimulus_start_reltime_text as a double
contents = cellstr(get(hObject,'String'));
rel_time = str2double(contents);
if isnan(rel_time)
msgbox('Error: could not parse relative time');
rel_time = 0;
handles.stimulus_start_reltime_text.String = '0';
else
handles.settings.dependencies.stimulus_start = { contents{get(hObject,'Value')} rel_time} ;
end
% --- Executes during object creation, after setting all properties.
function stimulus_start_reltime_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to stimulus_start_reltime_text (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 selection change in label_list.
function listbox4_Callback(hObject, eventdata, handles)
% hObject handle to label_list (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 label_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from label_list
% --- Executes during object creation, after setting all properties.
function listbox4_CreateFcn(hObject, eventdata, handles)
% hObject handle to label_list (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 label_listbox.
function label_listbox_Callback(hObject, eventdata, handles)
% hObject handle to label_listbox (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 label_listbox contents as cell array
% contents{get(hObject,'Value')} returns selected item from label_listbox
selected_label_ind = get(hObject,'Value');
labels = handles.settings.labels;
if ~isempty(labels)
current_label = labels(selected_label_ind).name;
current_label_type = labels(selected_label_ind).type;
current_label_pattern = labels(selected_label_ind).pattern;
handles.label_name_edit.String = current_label;
handles.label_pattern_edit.String = current_label_pattern;
if ~isempty(labels(selected_label_ind).dependency);
handles.label_dependent_popup.Value = 1; % .. lookup text
handles.dependent_label_check.Value = 1;
handles.label_reltime_text.String = labels(selected_label_ind).reltime;
end
end
% --- Executes during object creation, after setting all properties.
function label_listbox_CreateFcn(hObject, eventdata, handles)
% hObject handle to label_listbox (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 button press in add_label_button.
function add_label_button_Callback(hObject, eventdata, handles)
% hObject handle to add_label_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
label_name = handles.label_name_edit.String;
label_pattern = handles.label_pattern_edit.String;
all_types = cellstr(get(handles.labeltype_popup, 'String'));
label_type = all_types{get(handles.labeltype_popup,'Value')};
stop_flag = 0;
%% check for empty labels / patterns
if (isempty(label_pattern) || isempty(label_name))
msgbox('Label not specified');
stop_flag = 1;
end
settings = handles.settings;
%% check for identical labels
for l = 1:length(settings.labels)
if (strcmp(label_name, settings.labels(l).name) || ...
strcmp(label_pattern, settings.labels(l).pattern))
msgbox('Label already exists');
stop_flag = 1;
end
end
if (~stop_flag)
index = length(settings.labels) + 1;
settings.labels(index).name = label_name;
settings.labels(index).pattern = label_pattern;
settings.labels(index).type = label_type;
settings.labels(index).dependency = {};
handles.settings = settings;
populate_label_listbox(hObject, handles);
handles.label_name_edit.String = '';
handles.label_pattern_edit.String = '';
end
guidata(hObject, handles); %% store new labels
populate_label_listbox(hObject, handles);
function populate_label_listbox(hObject, handles)
%% populate labels in the listbox
handles = guidata(hObject);
settings = handles.settings;
labels = settings.labels;
label_string{1} = '<html><i>No labels defined</i></html>';
for l = 1:length(labels)
if ~isempty(labels(l).pattern);
label_string{l} = sprintf('<html><b>%s</b> - (pattern: "<i>%s</i>", type: <b>%s</b>)</html>', labels(l).name, labels(l).pattern, labels(l).type);
end
if ~isempty(labels(l).dependency)
if labels(l).rel_time < 0
prepo = 'prior to';
elseif labels(l).rel_time == 0
prepo = 'at ';
else
prepo = 'post ';
end
if labels(l).rel_time == 0
label_string{l} = sprintf('<html><b>%s</b> - (%s %s, type: <b>%s</b>)</html>', ...
labels(l).name, prepo, labels(l).dependency, ...
labels(l).type);
else
label_string{l} = sprintf('<html><b>%s</b> - (%d ms %s %s, type: <b>%s</b>)</html>', ...
labels(l).name, abs(labels(l).rel_time), prepo, labels(l).dependency, ...
labels(l).type);
end
end
end
handles.label_listbox.Value = 1;
handles.label_listbox.String = label_string;
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
selected_label_ind = get(handles.label_listbox,'Value');
answer = questdlg('Are you sure?' , 'Confirm deletion', 'Yes', 'No', 'No');
if strcmp(answer, 'Yes')
if ~isempty(handles.settings.labels)
handles.settings.labels(selected_label_ind) = [];
handles.label_name_edit.String = '';
handles.label_pattern_edit.String = '';
guidata(hObject, handles);
populate_label_listbox(hObject, handles);
end
end
function label_pattern_edit_Callback(hObject, eventdata, handles)
% hObject handle to label_pattern_edit (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 label_pattern_edit as text
% str2double(get(hObject,'String')) returns contents of label_pattern_edit as a double
% --- Executes during object creation, after setting all properties.
function label_pattern_edit_CreateFcn(hObject, eventdata, handles)
% hObject handle to label_pattern_edit (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 selection change in labeltype_popup.
function labeltype_popup_Callback(hObject, eventdata, handles)
% hObject handle to labeltype_popup (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 labeltype_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from labeltype_popup
% --- Executes during object creation, after setting all properties.
function labeltype_popup_CreateFcn(hObject, eventdata, handles)
% hObject handle to labeltype_popup (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
function label_reltime_text_Callback(hObject, eventdata, handles)
% hObject handle to label_reltime_text (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 label_reltime_text as text
% str2double(get(hObject,'String')) returns contents of label_reltime_text as a double
% --- Executes during object creation, after setting all properties.
function label_reltime_text_CreateFcn(hObject, eventdata, handles)
% hObject handle to label_reltime_text (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 dependent_label_check.
function dependent_label_check_Callback(hObject, eventdata, handles)
% hObject handle to dependent_label_check (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 dependent_label_check
if get(hObject, 'Value')
handles.label_dependent_popup.Enable = 'on';
handles.label_reltime_text.Enable = 'on';
handles.label_text.Enable = 'off';
else
handles.label_dependent_popup.Enable = 'off';
handles.label_reltime_text.Enable = 'off';
handles.label_text.Enable = 'on';
end
% --- Executes on selection change in label_dependent_popup.
function label_dependent_popup_Callback(hObject, eventdata, handles)
% hObject handle to label_dependent_popup (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 label_dependent_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from label_dependent_popup
% --- Executes during object creation, after setting all properties.
function label_dependent_popup_CreateFcn(hObject, eventdata, handles)
% hObject handle to label_dependent_popup (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
function label_name_edit_Callback(hObject, eventdata, handles)
% hObject handle to label_name_edit (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 label_name_edit as text
% str2double(get(hObject,'String')) returns contents of label_name_edit as a double
% --- Executes during object creation, after setting all properties.
function label_name_edit_CreateFcn(hObject, eventdata, handles)
% hObject handle to label_name_edit (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 update_button.
function update_button_Callback(hObject, eventdata, handles)
% hObject handle to update_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
labels = handles.settings.labels;
label_selected = get(handles.label_listbox,'Value');
new_label_name = handles.label_name_edit.String;
new_label_pattern = handles.label_pattern_edit.String;
if (isempty(new_label_pattern) || isempty(new_label_name))
msgbox('Label not specified');
end
if label_selected > 0
labels(label_selected).name = new_label_name;
labels(label_selected).pattern = new_label_pattern;
else
msgbox('No item selected');
end
handles.settings.labels = labels;
guidata(hObject, handles);
populate_label_listbox(hObject, handles)
% --- Executes on button press in multiple_labels.
function multiple_labels_Callback(hObject, eventdata, handles)
% hObject handle to multiple_labels (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
popup_items = {'Trial Start', 'Trial End', 'Baseline Start', 'Baseline End', 'Stimulus Start', 'Stimulus End', 'Label'};
types = {'Normal', 'Deconvolution'};
answer_rel_item = listdlg('ListString', popup_items, 'PromptString', 'Select a starting point for all labels', 'ListSize', [150 100]);
if isempty(answer_rel_item)
return;
end
info_string = {'Enter the relative time in ms between the first label to be created and the selected starting point', ...
'Enter the number of labels to create ', ...
'Enter the time in ms between each label'};
answer_mult_label_info = inputdlg(info_string, 'Specify multiple labels', 1, {'100', '1', '100'});
if isempty(answer_mult_label_info)
return;
end
label_name = inputdlg('Specify label name', 'Specify label name', 1, {'Label %d'});
if isempty(label_name)
return;
end
label_type = listdlg('ListString', types, 'PromptString','Specify label name','ListSize',[150 50]);
if isempty(label_type)
return;
end
%try
rel_onset = str2double(answer_mult_label_info{1});
num_labels = str2double(answer_mult_label_info{2});
label_dt = str2double(answer_mult_label_info{3});
labels = handles.settings.labels; current_num = length(labels);
for l = 1:num_labels
labels(current_num+l).pattern = '';
labels(current_num+l).name = sprintf(label_name{1}, l);
labels(current_num+l).type = types{label_type};
labels(current_num+l).rel_time = rel_onset + ((l-1) * label_dt);
labels(current_num+l).dependency = popup_items{answer_rel_item};
end
%catch
% msgbox('Input incorrect');
%end
handles.settings.labels = labels;
guidata(hObject, handles);
populate_label_listbox(hObject, handles)