view listeningTest/pairComp/endPairComp.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 5e72201496c8
children
line wrap: on
line source
function endPairComp(hf)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dat=get(hf,'userdata');
sesDat=dat.sesDat;
reREAD=sesDat.reREAD;
rsl=dat.rsl;

noComb=dat.noComb;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% collect datas in .rsl 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if noComb<=dat.nbComb
   if dat.nbQuest
      for noQuest=1:dat.nbQuest
         rsl.quest(noComb,noQuest)=get(dat.hQuest(noQuest),'value');
%          if(rsl.quest(noComb,noQuest))
%              disp(noQuest); % in case of crash
%          end
      end
   end
   if dat.nbScale
      for noScale=1:dat.nbScale
         rsl.scale(noComb,noScale)=get(dat.hScale(noScale),'value');
      end
   end
   if dat.COM
      rsl.com{noComb}=get(dat.hCom,'string');
   end   
   
   dat.rsl=rsl;
   dat.noComb=noComb+1;
   set(hf,'name',sprintf('%d tests left / pair #%d/%d',sesDat.nbTst-sesDat.noTst,dat.noComb,dat.nbComb));
   set(hf,'userdata',dat);
   
   % reLAUNCH the next pair comparison
   
   if noComb<dat.nbComb
      if reREAD
         if dat.nbQuest
            for noQuest=1:dat.nbQuest
               set(dat.hQuest(noQuest),'value',rsl.quest(noComb+1,noQuest));
            end
         end
         if dat.nbScale
            for noScale=1:dat.nbScale
               set(dat.hScale(noScale),'value',rsl.scale(noComb+1,noScale));
            end
         end
         if dat.COM
            set(dat.hCom,'string',rsl.com{noComb+1});
         end         
      else
         if dat.nbQuest
            set(dat.hQuest,'value',0);
         end
         if dat.nbScale
            for noScale=1:dat.nbScale
               set(dat.hScale(noScale),'value',get(dat.hScale(noScale),'min'));
            end
         end
         if dat.COM
            set(dat.hCom,'string',dat.stri);
         end         
      end
      return
   end
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Timer 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rsl.duration=etime(clock,dat.t0);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% generate a small report file 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fid=reportTest(sesDat,rsl,'PAIR COMPARISONS');

if dat.nbScale
   fprintf(fid,'--------- scales ');eol(fid);
   for noScale=1:dat.nbScale
      fprintf(fid,'Scale #%d : %s',noScale,dat.scale(noScale).name);eol(fid);
   end
end

fprintf(fid,'------------- COMBINATIONS ');eol(fid);eol(fid);
fprintf(fid,'A\t B\t ');eol(fid);

for noComb=1:dat.nbComb
   fprintf(fid,'%d \t %d ',dat.comb(noComb,1),dat.comb(noComb,2));eol(fid);
end
eol(fid);

for noComb=1:dat.nbComb
    fprintf(fid,'%d \t %d ',dat.comb(noComb,1),dat.comb(noComb,2));eol(fid);
    if (dat.comb(noComb,1) - dat.comb(noComb,2) == 0)
        if (rsl.quest(noComb,3)==0)
            disp('FALSE UNEQUAL');
            fprintf(fid,'PROBLEM: False unequal');
        end
    else if (rsl.quest(noComb,3)) 
            if (dat.comb(noComb,1) - dat.comb(noComb,2) ~= 0)
                disp('FALSE EQUAL');
                fprintf(fid,'PROBLEM: False equal');
            end
        end
    end
    if dat.nbScale
        fprintf(fid,'SCALES:\t');
        for noScale=1:dat.nbScale
            fprintf(fid,'%2.2f\t',rsl.scale(noComb,noScale));
        end
        eol(fid);   
    end
    if dat.nbQuest
        fprintf(fid,'QUESTS:\t');
        for noQuest=1:dat.nbQuest
            if rsl.quest(noComb,noQuest)
                fprintf(fid,'%s',dat.quest{noQuest});eol(fid);
            end
        end
        eol(fid);   
    end
    if dat.COM
        fprintf(fid,'COM:\t');
        scom=rsl.com{noComb}';
        fprintf(fid,'%s',scom(:));eol(fid);eol(fid);
    end
end

fprintf(fid,'------------- LIST OF RESULTS');eol(fid);eol(fid);

for noComb=1:dat.nbComb
    if rsl.quest(noComb,1)
        fprintf(fid,'%d',dat.comb(noComb,1));eol(fid);
    else if rsl.quest(noComb,2)
            fprintf(fid,'%d',dat.comb(noComb,2));eol(fid);
        else
            fprintf(fid,'%d',0);eol(fid);
        end
    end
end
eol(fid);

fclose(fid);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Save it
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dat=get(hf,'userdata');
saveTest(dat,rsl,'paircomp');