Mercurial > hg > ape
diff listeningTest/multiComp/saveMultiComp.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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/listeningTest/multiComp/saveMultiComp.m Thu Apr 24 23:53:31 2014 +0100 @@ -0,0 +1,62 @@ +function saveMultiComp(hf) % called from 'endmultiComp' or whenever temporarily saved + +dat=get(hf,'userdata'); + +test=dat.test; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Collect the results into rsl +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +rsl.gcom=strrep(get(dat.gcom,'string'), sprintf('\n'),'; '); % general comments +rsl.hcom=get(struct([]), 'struct'); % empty array of individual comments +rsl.permVec=dat.permVec; +rsl.playVec=dat.playVec; + +nbSnd=test.nbComb; +nbScale=length(test.scale); + +for noScale=1:nbScale + for noSnd=1:nbSnd + rsl.hcom{noSnd}=strrep(get(dat.hcom{noSnd}, 'string'), sprintf('\n'),'; '); % individual comments + posIc=get(dat.hIcon(noScale,noSnd),'position'); + scale=test.scale(noScale); + posx=posIc(1); + dxx=dat.dxx; + dxI=dat.dxI; + minx=scale.minn; + maxx=scale.maxx; + stepp=scale.stepp; + a=(maxx-minx)/(1-2*dxx); + b=minx-a*dxx; + nx=a*(posx+dxI/2)+b; + rsl.mat(noScale,noSnd)=nx; + end +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Save it +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +test=[]; +indDat=[]; +sesDat=dat.sesDat; + +test.rsl=rsl; +test.tstFile=sesDat.tstDat{dat.sesDat.noTst}.tstFile; +test.tstType=sesDat.tstDat{dat.sesDat.noTst}.tstType; +test.sndFile=sesDat.cuSndListFile; + +% Create new test data file +sesDat.tstDat{dat.sesDat.noTst}=test; + +% make temporary variable in workspace +assignin('base','multiComp',test); + +% save the individual session +indDat.id=sesDat.id; +indDat.sesScript=sesDat.sesScript; +indDat.tstDat=sesDat.tstDat; +eval(sprintf('%s=indDat;',indDat.id)); +expre=sprintf('save(''responses/%s'',''%s'')',indDat.id,indDat.id); +eval(expre);