annotate listeningTest/multiComp/endMultiComp.m @ 15:24be5e9ce25b tip

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