# HG changeset patch # User Brecht De Man # Date 1417546894 0 # Node ID 3c26ad25104384357d5e9f3959ce8dbabf4bc7d1 # Parent ee22af6610a350bdaaeddec89a28ca1e3d8fa923 Different screens only in random order when session files contains the word 'random' diff -r ee22af6610a3 -r 3c26ad251043 listeningTest/launch.m --- 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