109 lines
2.2 KiB
Matlab
109 lines
2.2 KiB
Matlab
function[e] = add_aggregate(varargin)
|
|
e = varargin{1}
|
|
|
|
%% magical stuff so we are not overwriting...
|
|
fig = gcf;%e.handle(2);
|
|
figure(fig);
|
|
plotwindow_id = num2str(fig);
|
|
|
|
subj_pop = findobj('Tag', ['subj_pop.' plotwindow_id]);
|
|
sess_pop = findobj('Tag', ['sess_pop.' plotwindow_id]);
|
|
trial_pop = findobj('Tag', ['trial_pop.' plotwindow_id]);
|
|
select_edit = findobj('Tag', ['select_edit.' plotwindow_id]);
|
|
|
|
subject_val = get(subj_pop, 'Value');
|
|
session_val = get(sess_pop, 'Value');
|
|
trial_val = get(trial_pop, 'Value');
|
|
select_edit = get(select_edit, 'String');
|
|
|
|
subject_strings = cellstr(get(subj_pop, 'String'));
|
|
session_strings = cellstr(get(sess_pop, 'String'));
|
|
trial_strings = cellstr(get(trial_pop, 'String'));
|
|
|
|
if iscell(subject_val)
|
|
subjects = subject_strings{subject_val{1}};
|
|
else
|
|
subjects = subject_strings{subject_val};
|
|
end
|
|
|
|
|
|
if iscell(session_val)
|
|
sessions = session_val{1};
|
|
else
|
|
sessions = session_val;
|
|
end
|
|
|
|
if iscell(trial_val)
|
|
trials = trial_strings{trial_val{1}};
|
|
else
|
|
trials = trial_strings{trial_val};
|
|
end
|
|
tmp = get(fig, 'UserData');
|
|
|
|
if isempty(tmp)
|
|
tmp;
|
|
end
|
|
|
|
switch subjects
|
|
case 1
|
|
subjects = 1:length(e.subjects);
|
|
case 2
|
|
subjects = tmp.selected_subjects;
|
|
end
|
|
|
|
switch sessions
|
|
case 1
|
|
sessions= 1:length(e.subjects(1).sessions);
|
|
case 2
|
|
sessions = tmp.selected_subjects;
|
|
end
|
|
|
|
switch trials
|
|
case 1
|
|
trials = 1:length(e.subjects(1).sessions(1).trials);
|
|
case 2
|
|
trials = tmp.selected_subjects;
|
|
end
|
|
|
|
|
|
groupname = inputdlg('Give a name for the group');
|
|
if isempty(groupname)
|
|
return;
|
|
end
|
|
|
|
color = uisetcolor('Choose a color');
|
|
if length(color) ==1
|
|
return;
|
|
end
|
|
|
|
|
|
|
|
agg_id = length(e.aggregates)+1
|
|
|
|
if (length(color) == 1)
|
|
color = repmat(color, 1,3);
|
|
end
|
|
|
|
|
|
|
|
e.aggregates(agg_id).name = groupname;
|
|
e.aggregates(agg_id).subjects = subjects;
|
|
e.aggregates(agg_id).sessions = sessions;
|
|
e.aggregates(agg_id).trials = trials;
|
|
e.aggregates(agg_id).color = color;
|
|
|
|
e.aggregates(agg_id).mean = [];
|
|
e.aggregates(agg_id).std = [];
|
|
e.aggregates(agg_id).var = [];
|
|
|
|
e.aggregates(agg_id).error.name = 'None';
|
|
%e.aggregates(agg_id).variance = variance;
|
|
|
|
|
|
e = e.update_aggregates;
|
|
|
|
assignin('base','e',e);
|
|
|
|
|
|
|