diff listeningTest/saveTest.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 ee22af6610a3
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/listeningTest/saveTest.m	Thu Apr 24 23:53:31 2014 +0100
@@ -0,0 +1,44 @@
+function [sesDat,indDat]=saveTest(dat,rsl,typeTst)
+
+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',typeTst,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);
+
+% close the test window
+closereq;
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Call the next test 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+noTst=sesDat.noTst+1;
+nbTst=sesDat.nbTst;
+
+if ~(noTst>nbTst)
+   sesDat.noTst=noTst;
+   expr=sprintf('%s(sesDat)',sesDat.tstDat{noTst}.tstType);
+   eval(expr);
+end
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Clean up
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+clear;