comparison listeningTest/multiComp/endMultiComp.m @ 0:4fd284285159

Adding listening test plus some helpful functions and scripts.
author Brecht <b.deman@qmul.ac.uk>
date Thu, 24 Apr 2014 23:53:31 +0100
parents
children d113f0626fe3
comparison
equal deleted inserted replaced
-1:000000000000 0:4fd284285159
1 function endMultiComp(hf) % called when 'Finished' clicked
2
3 playSound([]); % stop all sound
4
5 dat=get(hf,'userdata');
6
7 if(sum(dat.playVec) ~= size(dat.sesDat.cuSndList,2))
8 x = mat2str(dat.permVec(find(dat.playVec==0)));
9 errordlg(['Please continue until all sounds are assessed: you haven''t listened to ' x ' yet.'], 'Not all sounds played!');
10 return;
11 end
12
13 % are you sure?
14 choice = questdlg('Are you sure you are finished and want to submit your response for this round?','Finish and submit','No','Yes','No');
15 if strcmp(choice, 'No')
16 return;
17 end
18
19 % TODO: replace some of the following by savemultiComp
20
21 sesDat=dat.sesDat;
22 test=dat.test;
23
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 % Collect the results into rsl
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27
28 rsl.gcom=get(dat.gcom,'string'); % general comments
29 rsl.hcom=get(struct([]), 'struct'); % empty array of individual comments
30 rsl.permVec=dat.permVec;
31 rsl.playVec=dat.playVec;
32
33 nbSnd=test.nbComb;
34 nbScale=length(test.scale);
35
36 for noScale=1:nbScale
37 for noSnd=1:nbSnd
38 rsl.hcom{noSnd}=get(dat.hcom{noSnd}, 'string'); % individual comments
39 posIc=get(dat.hIcon(noScale,noSnd),'position');
40 scale=test.scale(noScale);
41 posx=posIc(1);
42 dxx=dat.dxx;
43 dxI=dat.dxI;
44 minx=scale.minn;
45 maxx=scale.maxx;
46 stepp=scale.stepp;
47 a=(maxx-minx)/(1-2*dxx);
48 b=minx-a*dxx;
49 nx=a*(posx+dxI/2)+b;
50 rsl.mat(noScale,noSnd)=nx;
51 end
52 end
53
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 % Timer
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 rsl.duration=etime(clock,dat.t0);
58
59
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 % generate a small report file
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 fid=reportTest(sesDat,rsl,'MULTIPLE COMPARISON 1D');
64
65 % scales
66 fprintf(fid,'%%%%%%%%%%%% scales ');eol(fid);eol(fid);
67 for noScale=1:nbScale
68 fprintf(fid,'Scale #%d -- %s',noScale,test.scale(noScale).name);eol(fid);
69 end
70
71 % matrix results
72 for noScale=1:nbScale
73 fprintf(fid,'SCALE #%d: ',noScale);
74 for noSnd=1:nbSnd
75 fprintf(fid,'%2.2f \t',rsl.mat(noScale,noSnd));
76 end
77 eol(fid);
78 end
79
80 % COMMENTS
81 fprintf(fid,'');eol(fid);
82 fprintf(fid,'%%%%%%%%%%%% COMMENTS');eol(fid);
83
84 for index = 1:nbSnd
85 com = rsl.hcom{dat.permVec(index)}; % individual comments
86 fprintf(fid,'Sound %d, marker %s\n',index,com);
87 end
88
89 fprintf(fid,'%s\n',rsl.gcom); % print general comments
90
91
92 eol(fid);eol(fid);
93 fclose(fid);
94
95
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 % Save it
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 dat=get(hf,'userdata');
100 saveTest(dat,rsl,'multiComp');