b@0
|
1 function multiComp(sesDat)
|
b@0
|
2
|
b@0
|
3 % multiple comparison test on several 1D scale
|
b@0
|
4 % see readMultiComp for a description of specifications
|
b@0
|
5
|
b@0
|
6 UIControl_FontSize_bak = get(0, 'DefaultUIControlFontSize');
|
b@0
|
7 set(0, 'DefaultUIControlFontSize', 20);
|
b@0
|
8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
9 % copy useful variables
|
b@0
|
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
11
|
b@0
|
12 reREAD=sesDat.reREAD;
|
b@0
|
13 noTst=sesDat.noTst;
|
b@0
|
14 nbTst=sesDat.nbTst;
|
b@0
|
15
|
b@0
|
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
17 % read the test file
|
b@0
|
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
19 test=readMultiComp(sesDat.tstDat{noTst}.tstFile);
|
b@0
|
20
|
b@0
|
21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
22 % Set the test screen
|
b@0
|
23 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
24
|
b@0
|
25 hf=figure;
|
b@0
|
26 set(hf,'units','normalized');
|
b@0
|
27 set(hf,'position',[0.1 .15 .80 1.0]); % TODO make automatic % [left, bottom, width, height]
|
b@0
|
28 set(hf,'closereq',[]);
|
b@0
|
29 set(hf,'numbertitle','off');
|
b@0
|
30 set(hf,'menubar','none');
|
b@0
|
31 if (nbTst-noTst)/2 > 1
|
b@0
|
32 titlestr = sprintf('%d screens left',(nbTst-noTst)/2);
|
b@0
|
33 else if (nbTst-noTst) > 1
|
b@0
|
34 titlestr = 'One screen left after this';
|
b@0
|
35 else
|
b@0
|
36 titlestr = 'Last screen';
|
b@0
|
37 end
|
b@0
|
38 end
|
b@0
|
39 set(hf,'name',titlestr);
|
b@0
|
40 set(gca,'position',[0 0 1 1]);
|
b@0
|
41 axis([0 1 0 1]);
|
b@0
|
42 set(gca,'yticklabel',[]);
|
b@0
|
43 set(gca,'xticklabel',[]);
|
b@0
|
44 grid off;
|
b@0
|
45 hp=gca;
|
b@0
|
46
|
b@0
|
47 set(hp,'color',[.7 .7 .7]); % gray background
|
b@0
|
48
|
b@0
|
49 % Figure-event properties
|
b@2
|
50 set(hf,'windowbuttonmotionfcn',sprintf('MmoveW(%d)',hf.Number));
|
b@2
|
51 set(hf,'keypressfcn',sprintf('TpushKey(%d)',hf.Number));
|
b@0
|
52
|
b@0
|
53 % Define Scales and SonIcons
|
b@0
|
54
|
b@0
|
55 nbScale=length(test.scale);
|
b@0
|
56 dY=1/(nbScale+3); % vertical space for each scale+text (used to be +1, now +3)
|
b@0
|
57 dX=1;
|
b@0
|
58 dyy=dY/2; % vertical space for scale and text
|
b@0
|
59 dxx=1/30; % vertical margins of the scale
|
b@0
|
60 small=dyy/10;
|
b@0
|
61
|
b@0
|
62 % create sonicons
|
b@0
|
63 nbSnd=test.nbComb;
|
b@0
|
64
|
b@0
|
65 % RANDOM POSITIONS and ALREADY PLAYED
|
b@0
|
66 if reREAD && isfield(sesDat.tstDat{noTst}, 'rsl')
|
b@0
|
67 permVec = sesDat.tstDat{noTst}.rsl.permVec;
|
b@0
|
68 playVec = sesDat.tstDat{noTst}.rsl.playVec;
|
b@0
|
69 else
|
b@0
|
70 permVec = randperm(nbSnd);
|
b@0
|
71 playVec = zeros(nbSnd,1);
|
b@0
|
72 end
|
b@0
|
73
|
b@0
|
74 fidInd=['responses/' sesDat.id,'_',sesDat.sesScript]; % print permutation in response log
|
b@0
|
75 fid=fopen(fidInd,'a');
|
b@0
|
76 fprintf(fid,'\n%s\n', 'Random permutation mapping (comments): ');
|
b@0
|
77 for noSnd = 1: nbSnd
|
b@0
|
78 fprintf(fid,'%d ', permVec(noSnd));
|
b@0
|
79 end
|
b@0
|
80 fprintf(fid,'\n%s\n', ' ');
|
b@0
|
81
|
b@0
|
82
|
b@0
|
83 for noScale=1:nbScale
|
b@0
|
84
|
b@0
|
85 y=1-noScale*dY; % bottom line
|
b@0
|
86 dyt=dyy; % was 3/2*
|
b@0
|
87 %display text
|
b@0
|
88 h='horizontalAlignment';
|
b@0
|
89 v='verticalAlignment';
|
b@0
|
90 text(.5,y+dyt,test.scale(noScale).name,h,'center',v,'bottom', 'FontSize', 24); % Scale name
|
b@0
|
91 % Level names
|
b@0
|
92 text(0+small,y+dyt,test.scale(noScale).level{1},h,'left',v,'bottom', 'FontSize', 24); % MINIMUM
|
b@0
|
93 text(1-small,y+dyt,test.scale(noScale).level{3},h,'right',v,'bottom', 'FontSize', 24); % MAXIMUM
|
b@0
|
94
|
b@0
|
95 % Display 1D rules
|
b@0
|
96 y0=y;
|
b@0
|
97 y1=y+dyy;
|
b@0
|
98 hold on;
|
b@0
|
99 fill([dxx dxx 1-dxx 1-dxx],[y1 y0 y0 y1],[.8 .8 .8]);
|
b@0
|
100
|
b@0
|
101
|
b@0
|
102 for noSnd=1:nbSnd
|
b@0
|
103
|
b@0
|
104 dl=(1-2*dxx)/5; %BDM used to be /nbsnd
|
b@0
|
105 xI=dl*noSnd/2;
|
b@0
|
106 dxI=dl/10; % width of a sonicon
|
b@0
|
107 posIc=[xI y+small dxI dyy-2*small];
|
b@0
|
108
|
b@0
|
109 % position the icons on the default position
|
b@0
|
110 % check if the individual data contains already some past results
|
b@0
|
111 %
|
b@0
|
112 if reREAD && isfield(sesDat.tstDat{noTst}, 'rsl')
|
b@0
|
113 posComb=sesDat.tstDat{noTst}.rsl.mat(noScale,noSnd);
|
b@0
|
114 else
|
b@0
|
115 posComb=test.posComb(noSnd,noScale);
|
b@0
|
116 fidInd=['responses/' sesDat.id,'_',sesDat.sesScript]; % print initial placing
|
b@0
|
117 fid=fopen(fidInd,'a');
|
b@0
|
118 fprintf(fid,'%f ', test.posComb(noSnd,noScale));
|
b@0
|
119 end
|
b@0
|
120
|
b@0
|
121 % Calculate Icon position relative to the screen units
|
b@0
|
122 minx=test.scale(noScale).minn;
|
b@0
|
123 maxx=test.scale(noScale).maxx;
|
b@0
|
124 a=(1-2*dxx)/(maxx-minx);
|
b@0
|
125 b=dxx-a*minx;
|
b@0
|
126 posIc(1)=posComb*a+b-dxI/2;
|
b@0
|
127
|
b@0
|
128 % set handles
|
b@0
|
129 hIc=uicontrol('style','text','string',num2str(permVec(noSnd)),'units','normalized','position',posIc); % changed by Brecht: randperm
|
b@2
|
130 set(hIc,'buttondownfcn',sprintf('MpushIc(%d)',hf.Number));
|
b@0
|
131 set(hIc,'backgroundcolor', [.6 .9 .6]); % set colour to green
|
b@0
|
132
|
b@0
|
133 %%%%%%%%%%%%%%%%%%% ENABLING
|
b@0
|
134 set(hIc,'enable','inactive');
|
b@0
|
135 set(hIc,'tag','sonicon');
|
b@0
|
136
|
b@0
|
137 sndId=test.comb(noSnd);
|
b@0
|
138 set(hIc,'userdata',sndId);
|
b@0
|
139 hIcon(noScale,noSnd)=hIc;
|
b@0
|
140
|
b@0
|
141 end
|
b@0
|
142 fprintf(fid,'%s\n', ' ');
|
b@0
|
143 %shIc= set(hIc); %??? what is this here for? suppress output.
|
b@0
|
144
|
b@0
|
145 % set the un-movable references
|
b@0
|
146 nbRef=length(test.sndRef);
|
b@0
|
147 for noRef=1:nbRef
|
b@0
|
148 sndRef=test.sndRef(noRef);
|
b@0
|
149 %%%%%%%%%%%%%%%%%%%%%% ENABLING...
|
b@0
|
150 set(hIcon(noScale,sndRef),'enable','off'); %% for MAC! may be 'off' for PC??
|
b@0
|
151 set(hIcon(noScale,sndRef),'string','ref');
|
b@0
|
152 end
|
b@0
|
153
|
b@0
|
154
|
b@0
|
155 end
|
b@0
|
156
|
b@0
|
157
|
b@0
|
158 % create Comments
|
b@0
|
159 hcom = struct([]); % create empty struct for comments
|
b@11
|
160 if reREAD && isfield(sesDat.tstDat{noTst}, 'rsl') % recall comments
|
b@0
|
161 for noSnd = 1:nbSnd % a comment per sample
|
b@0
|
162 posCom=[dxx 6*dY/(nbSnd+2)+3*dY/(nbSnd+2)*(nbSnd - noSnd) 10/15 3*dY/(nbSnd+2)-small]; % [left, bottom, width, height]
|
b@0
|
163 commentstr = sesDat.tstDat{noTst}.rsl.hcom{noSnd};
|
b@0
|
164 hcom{noSnd} = uicontrol('style','edit','max',2,'string',commentstr, ...
|
b@0
|
165 'units','normalized','position',posCom, ...
|
b@0
|
166 'HorizontalAlignment', 'left');
|
b@0
|
167 end
|
b@0
|
168
|
b@0
|
169 posCom=[dxx small 10/15 6*dY/(nbSnd+2)-small]; % general comments
|
b@0
|
170 commentstr = sesDat.tstDat{noTst}.rsl.gcom;
|
b@0
|
171 gcom=uicontrol('style','edit','max',2,'string',commentstr, ...
|
b@0
|
172 'units','normalized','position',posCom, 'HorizontalAlignment', 'left');
|
b@0
|
173
|
b@0
|
174
|
b@11
|
175 else % new comments
|
b@0
|
176 for noSnd = 1:nbSnd % a comment per sample
|
b@0
|
177 posCom=[dxx 6*dY/(nbSnd+2)+3*dY/(nbSnd+2)*(nbSnd - noSnd) 10/15 3*dY/(nbSnd+2)-small]; % [left, bottom, width, height]
|
b@0
|
178 commentstr = sprintf('%d: ', noSnd);
|
b@0
|
179 hcom{noSnd} = uicontrol('style','edit','max',2,'string',commentstr, ...
|
b@0
|
180 'units','normalized','position',posCom, ...
|
b@0
|
181 'HorizontalAlignment', 'left');
|
b@0
|
182 end
|
b@0
|
183
|
b@0
|
184 posCom=[dxx small 10/15 6*dY/(nbSnd+2)-small]; % general comments
|
b@0
|
185 commentstr = sprintf('%s: ', 'General comments');
|
b@0
|
186 gcom=uicontrol('style','edit','max',2,'string',commentstr, ...
|
b@0
|
187 'units','normalized','position',posCom, 'HorizontalAlignment', 'left');
|
b@0
|
188
|
b@0
|
189 end
|
b@0
|
190
|
b@0
|
191
|
b@0
|
192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
193 % "Stop audio" button
|
b@0
|
194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
195
|
b@0
|
196 posFin=[11/15 3*dY/2 3/15 3*(dY-small)/2]; % [left, bottom, width, height]
|
b@0
|
197 hFin=uicontrol('style','pushbutton','string','Stop audio','units','normalized','position',posFin);
|
b@2
|
198 set(hFin,'callback',sprintf('MpushIc(%d)',hf.Number));
|
b@0
|
199
|
b@0
|
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
201 % "Finished" button
|
b@0
|
202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
203
|
b@0
|
204 posFin=[11/15 small 3/15 3*(dY-small)/2]; % [left, bottom, width, height]
|
b@0
|
205 hFin=uicontrol('style','pushbutton','string','Finished','units','normalized','position',posFin);
|
b@2
|
206 set(hFin,'callback',sprintf('endMultiComp(%d)',hf.Number));
|
b@0
|
207
|
b@0
|
208
|
b@0
|
209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
210 % Test timer
|
b@0
|
211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
212 dat.t0=clock;
|
b@0
|
213
|
b@0
|
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
215 % Send useful datas
|
b@0
|
216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
217 dat.dxx = dxx; %?
|
b@0
|
218 dat.dxI = dxI; %?
|
b@0
|
219 dat.hf = hf;
|
b@0
|
220 dat.hcom = hcom; % individual comments
|
b@0
|
221 dat.gcom = gcom; % general comments
|
b@0
|
222 dat.hIcon = hIcon;
|
b@0
|
223 dat.drag = 0;
|
b@0
|
224 dat.test = test;
|
b@0
|
225 dat.sesDat = sesDat;
|
b@0
|
226 dat.playVec = playVec;
|
b@0
|
227 dat.permVec = permVec;
|
b@0
|
228 dat.nbScale = nbScale;
|
b@0
|
229 dat.nbSnd = nbSnd;
|
b@0
|
230 set(hf,'userdata',dat)
|
b@0
|
231
|
b@0
|
232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
233 % clean up
|
b@0
|
234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
b@0
|
235 clear all; |