-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStims_to_test_choose.m
86 lines (67 loc) · 4.2 KB
/
Stims_to_test_choose.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
h5 = figure('Color','white','units', 'normalized','Position',[.1 0.1 .8 .6],'Name','Choose stims to test' ,'MenuBar', 'none','ToolBar', 'none','CloseRequestFcn',@Delete_h); % ,'WindowStyle','modal');
% for uio = 1: size(All_info.data,2)
% All_Stims_choosen_to_test.data{1,uio} = zeros(size(All_Stims_choosen_to_fit.data{1,uio}));
% Ind = find(All_Stims_choosen_to_fit.data{1,uio}==1);
% All_Stims_choosen_to_test.data{1,uio}(Ind) = 1;
%
% Ind = find(All_Stims_choosen_to_fit.data{1,uio}==2);
% All_Stims_choosen_to_test.data{1,uio}(Ind) = 2;
% % a priori the ones which are stims (1), are not chosen...
% end
if prod(cellfun(@isempty, All_Stims_choosen_to_test.data))
for uio = 1: size(All_info.data,2)
All_Stims_choosen_to_test.data{1,uio} = double(~(~(All_info.data(uio).Index))); % a priori the ones which are stims (1), are not chosen...
end
end
Num_fam_ind = length(All_info.data);
N1 = round(Num_fam_ind/round(sqrt(Num_fam_ind)));
N2 = round(Num_fam_ind/N1);
if Num_fam_ind -N1*N2 > 0
N2 = N2 + 1;
end
Array_choose_stims_fam = cell(N1,N2);
Array_text_stims_fam = cell(N1,N2);
Array_stims_fit_mark = cell(N1,N2);
count = 1;
for j = 1 : N2
for u= 1: N1
[ left bottom width height] = Dimensionate_frame(zeros(N1,N2),u,j);
if (count <= length(All_info.data))
Bool_select1 = any(All_Stims_choosen_to_fit.data{1,count}(:) == 2);
if Bool_select1
Colr = [0 1 0];
else
Colr = [1 1 1];
end
Bool_select2 = any(All_Stims_choosen_to_test.data{1,count}(:) == 2);
Array_choose_stims_fam{u,j} = uicontrol('style','checkbox','units','normalized','position',[ (.01 + left*.5) (bottom*.5 + .2) width*.5 height*.2],'BackgroundColor',Colr,'Value',Bool_select2,'string',All_info.data(count).name,'callback',{@Identify_and_open,All_info,N1,N2, All_Stims_choosen_to_fit,All_Stims_choosen_to_test});
count = count + 1;
end
end
end
butt_Validate_and_close = uicontrol('Style','pushbutton','units', 'normalized','position', [0.75 0.05 0.2 0.08],'String','Validate and close ','callback',{@Validate_and_close,h5});
uiwait(h5)
function Identify_and_open(object_handle, event, All_info,N1,N2,All_Stims_choosen_to_fit,All_Stims_choosen_to_test)
temp = {};
for uu = 1: size(All_info.data,2)
temp{uu,1} = All_info.data(uu).name;
end
Num_fam = find(strcmp(event.Source.String,temp));
if object_handle.Value
Create_wind_for_substim_test;
if ~length(find(All_Stims_choosen_to_test.data{Num_fam} == 2))
object_handle.Value = 0;
end
else
temp = All_Stims_choosen_to_test.data{1,Num_fam};
Ind_ones = find(temp);
temp(Ind_ones) = 1; % 1 = non selected, 2= selected, 0 = no stim
All_Stims_choosen_to_test.data{1,Num_fam}= temp;
end
end
function Validate_and_close(object_handle, event, h5)
Delete_h(h5);
end
function Delete_h(object_handle, event)
delete(object_handle)
end