Mercurial > hg > ape
changeset 10:3c26ad251043
Different screens only in random order when session files contains the word 'random'
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Tue, 02 Dec 2014 19:01:34 +0000 |
parents | ee22af6610a3 |
children | 0014c50188da |
files | listeningTest/launch.m |
diffstat | 1 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/listeningTest/launch.m Sun Nov 30 21:44:03 2014 +0000 +++ b/listeningTest/launch.m Tue Dec 02 19:01:34 2014 +0000 @@ -87,6 +87,7 @@ % Read the script and create tstdat % IF THE TEST WAS DONE ALREADY ONCE, THE .MAT FILE IS USED INSTEAD (see above) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +RANDOMORDER = 0; if ~reREAD cd(cdScript); tstDat=[]; @@ -96,9 +97,13 @@ [fil1,COUNT,ERRMSG,NEXTINDEX] = sscanf(lin,'%s',1); if COUNT if ~strcmp(fil1(1),'%') % if not a comment - [fil2,COUNT,ERRMSG,NEXTINDEX] = sscanf(lin(NEXTINDEX:end),'%s',1); - tstDat{end+1}.tstType=fil1; % what type of test? - tstDat{end}.tstFile=fil2; % test file? + if ~sum(strfind(lower(fil1), 'random')) + [fil2,COUNT,ERRMSG,NEXTINDEX] = sscanf(lin(NEXTINDEX:end),'%s',1); + tstDat{end+1}.tstType=fil1; % what type of test? + tstDat{end}.tstFile=fil2; % test file? + else + RANDOMORDER = 1; + end end end end @@ -109,11 +114,13 @@ warning('Uneven number of lines in session script. '); % randomise order of tests else - testPerm = randperm(length(tstDat)/2); - tstDatCopy = tstDat; - for t = 1:length(tstDat)/2 - tstDat{2*t-1} = tstDatCopy{2*testPerm(t)-1}; - tstDat{2*t} = tstDatCopy{2*testPerm(t)}; + if RANDOMORDER + testPerm = randperm(length(tstDat)/2); + tstDatCopy = tstDat; + for t = 1:length(tstDat)/2 + tstDat{2*t-1} = tstDatCopy{2*testPerm(t)-1}; + tstDat{2*t} = tstDatCopy{2*testPerm(t)}; + end end end end