ET_PDToolkit/PDToolkit/@PDExperiment/enable_selection_edit.m

51 lines
1.3 KiB
Matlab

function[e] = enable_selection_edit(e, type)
fig = gcf;%e.handle(2);
plotwindow_id = num2str(fig);
figure(fig);
if strcmp(type,'subject'), code = 'subj'; end
if strcmp(type,'session'), code = 'sess'; end
if strcmp(type,'trial'), code = 'trial'; end
% Only continue if selection edit is requested:
popup = findobj('Tag', [code '_pop.' plotwindow_id]);
select_edit = findobj('Tag', ['selection_edit.' type '.' plotwindow_id]);
if ~(get(popup,'Value') == 2)
uicontrol(popup);
set(select_edit, 'Visible', 'off');
return
end
tmp = get(fig, 'UserData');
select_edit = findobj('Tag', ['selection_edit.' type '.' plotwindow_id]);
string = '';
if ~isempty(tmp)
switch type
case 'subject'
if isfield(tmp, 'selected_subjects')
string = num2str(tmp.selected_subjects);
end
case 'session'
if isfield(tmp, 'selected_sessions')
string = num2str(tmp.selected_sessions);
end
case 'trial'
if isfield(tmp, 'selected_trials')
string = num2str(tmp.selected_trials);
end
end
set(select_edit, 'String', string);
set(select_edit, 'Callback', ['e.evaluate_selection(''' type ''')']);
set(select_edit, 'UserData', type);
else
end
set(fig, 'UserData', tmp);
set(select_edit, 'Visible', 'on');
set(select_edit, 'Enable', 'on');
uicontrol(select_edit);