Test de stroop sous Matlab
Répondre à la discussion
Affichage des résultats 1 à 3 sur 3

Test de stroop sous Matlab



  1. #1
    invite4a71cba4

    Test de stroop sous Matlab


    ------

    Bonjour,

    J'essaye actuellement de designer un test de stroop sous Matlab qui s'inspire de ce modèle:


    Code PHP:
    http://www.onlinestrooptest.com/stroop_effect_test.php 

    Ma question est la suivante:

    quelle devrait être la structure de ce programme ?

    -----

  2. #2
    invite4a71cba4

    Re : Test de stroop sous Matlab

    En sachant que j'ai à ma disposition un programme qui suit la structure suivante:

    extrait:

    Code:
    level = 'ONE'; 
    
    TOTALCOUNT=TOTALCOUNT+1;
    
    if TOTALCOUNT == 1
        vectorAnswer = [0]; vectorTime = [0];   % for data analysis
        cla;drawnow; 
        h1=text(0,0,' ','color','w','units','normalized','position',[0.5 0.45],...
             'fontsize',60,'horizontalAlignment','center');
        h2=text(0,0,' ','color','w','units','normalized','position',[0.5 0.15],...
             'fontsize',40,'horizontalAlignment','center');
        set(h1,'string',sprintf('Welcome to training session.')); pause(2);
        set(h1,'string',sprintf('Please answer as quickly as you can..')); pause(3);
        set(h2,'string',sprintf('Press any key to start.'));
        pause();
        cla; drawnow;
    end
    % set(gcf,'units','normalized','position',[-1.1429 -0.0286 1.1429 0.9838]);
    pm=[1 1.5 2];
    
    switch level
        case 'ONE'
            dice = randi([1 4]);
            num1 = 10;
            if dice == 1           
                while num1 < 1 || num1 > 9
                    num2 = randi([1 9]);
                    num3 = randi([1 9]);
                    ans = randi([0 9]);
                    num1 = ans - num2 - num3;
                end
                operand1 = '+'; operand2 = '+';
             elseif dice == 2     
                while num1 < 1 || num1 > 9
                    num2 = randi([1 9]);
                    num3 = randi([1 9]);
                    ans = randi([0 9]);
                    num1 = num2 + num3 + ans;
                end
                operand1 = '-'; operand2 = '-';
            else
                while num1 < 1 || num1 > 9
                    numA = randi([1 9]);
                    numB = randi([1 9]);
                    ans = randi([0 9]);
                    num1 = ans - numA + numB;
                end
                if dice == 3        
                    num2 = numA; num3 = numB; operand1 = '+'; operand2 = '-';
                else               
                    num2 = numB; num3 = numA; operand1 = '-'; operand2 = '+';
                end
            end
        case 'TWO'
            dice = randi([1 5]);
            numD = 100;
            if dice < 3
                while numD > 99 || numD < 1
                    numA = randi([10 99]);
                    numB = randi([10 99]);
                    ans = randi([0 9]);
                    numD = numA + numB - ans;
                end
                num_set = [numA numB];
                sign_set = ['+' '-'];
                idx = randperm(numel(num_set));
                if rem(dice,2)
                    num1 = num_set(idx(1)); num2 = num_set(idx(2)); num3 = numD;
                    operand1 = sign_set(1); operand2 = sign_set(2); 
                else
                    num1 = num_set(idx(1)); num2 = numD; num3 = num_set(idx(2));  
                    operand1 = sign_set(2); operand2 = sign_set(1);
                end
            elseif dice == 3
                while numD > 99 || numD < 1
                    numA = randi([10 99]);
                    numB = randi([10 99]);
                    ans = randi([0 9]);
                    numD = numA - numB - ans;
                end
                num_set = [numB numD];
                sign_set = ['-' '-'];
                idx = randperm(numel(num_set));
                num1 = numA; num2 = num_set(idx(1)); num3 = num_set(idx(2)); 
                operand1 = sign_set(1); operand2 = sign_set(2); 
            else
                while numD > 99 || numD < 10
                    numA = randi([10 20]);
                    numB = randi([3 9]);
                    productAB = numA*numB;
                    ans = randi([0 9]);
                    if rem(dice,2)
                        numD = productAB - ans;
                    else
                        numD = productAB + ans;
                    end
                end
                num_set = [numA numB];
                sign_set = ['x' '-'];
                idx = randperm(numel(num_set));
                if rem(dice,2)
                    num1 = num_set(idx(1)); num2 = num_set(idx(2)); num3 = numD; 
                    operand1 = sign_set(1); operand2 = sign_set(2);
                else
                    num1 = numD; num2 = num_set(idx(1)); num3 = num_set(idx(2)); 
                    operand1 = sign_set(2); operand2 = sign_set(1); 
                end
            end
        case 'THREE'
            dice = randi([1 35]);
            numD = 100; numA = 100;
            if dice < 5
                while numD > 99 || numD < 1 || numA > 99 || numA < 1 
                    numB = randi([3 6]);
                    numA0 = randi([31 99]);
                    numA = numA0 * numB;
                    numC = randi([10 99]);
                    ans = randi([0 9]);
                    numD = (numA/numB) + numC - ans;
                end
                num_set = [numC numD];
                sign_set = ['/' '+' '-'];
                idx = randperm(numel(num_set));
                ng_pos = randi([1 4]);
                if ng_pos < 3
                    num1 = num2str(numA); num2 = num2str(numB); num3 = num2str(num_set(idx(1))); num4 = num2str(num_set(idx(2))); 
                    operand1 = sign_set(1); operand2 = sign_set(1+idx(1)); operand3 = sign_set(1+idx(2));
                elseif ng_pos == 3
                    num1 = num2str(numC); num2 = num2str(numA); num3 = num2str(numB); num4 = num2str(numD); 
                    operand1 = sign_set(2); operand2 = sign_set(1); operand3 = sign_set(3);
                else
                    num1 = num2str(numC); num2 = num2str(numD); num3 = num2str(numA); num4 = num2str(numB); 
                    operand1 = sign_set(3); operand2 = sign_set(2); operand3 = sign_set(1);
                end
            elseif dice == 5
                while numD > 99 || numD < 1 || numA > 99 || numA < 1 
                    numB = randi([3 6]);
                    numA0 = randi([31 99]);
                    numA = numA0 * numB;
                    numC = randi([10 99]);
                    ans = randi([0 9]);
                    numD = (numA/numB) - numC - ans;
                end
                num_set = [numC numD];
                sign_set = ['/' '-' '-'];
                idx = randperm(numel(num_set));
                num1 = num2str(numA); num2 = num2str(numB); num3 = num2str(num_set(idx(1))); num4 = num2str(num_set(idx(2))); 
                operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
            elseif dice > 5 && dice < 8
                while numD > 99 || numD < 1 || numA > 99 || numA < 1 
                    numB = randi([3 6]);
                    numA0 = randi([31 99]);
                    numA = numA0 * numB;
                    numC = randi([10 99]);
                    ans = randi([0 9]);
                    numD = ans - numC + (numA/numB);
                end
                num_set = [numC numD];
                sign_set = ['-' '/' '+'];
                idx = randperm(numel(num_set));
                if rem(dice,2)
                    num1 = num2str(num_set(idx(1))); num2 = num2str(numA); num3 = num2str(numB); num4 = num2str(num_set(idx(2))); 
                    operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
                else
                    num1 = num2str(num_set(idx(1))); num2 = num2str(num_set(idx(2))); num3 = num2str(numA); num4 = num2str(numB); 
                    operand1 = sign_set(3); operand2 = sign_set(1); operand3 = sign_set(2);
                end
            elseif dice == 8
                while numD > 99 || numD < 1 || numA > 99 || numA < 1 
                    numB = randi([3 6]);
                    numA0 = randi([31 99]);
                    numA = numA0 * numB;
                    numC = randi([10 99]);
                    ans = randi([0 9]);
                    numD = numC - ans - (numA/numB);
                end
                sign_set = ['-' '-' '/'];
                num1 = num2str(numC); num2 = num2str(numD); num3 = num2str(numA); num4 = num2str(numB); 
                operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
            elseif dice >8 && dice < 11
                while numD > 99 || numD < 1 || numA > 99 || numA < 1 
                    numB = randi([1 9]);
                    numC = randi([1 9]);
                    numA0 = randi([1 9]);
                    numA = numA0 * numB * numC;
                    ans = randi([0 9]);
                    numD = ans - (numA/(numB*numC));
                end
                num_set = [numB numC];
                sign_set = ['/' 'x' '+'];
                idx = randperm(numel(num_set));
                if rem(dice,2)
                    num1 = num2str(numA); num2 = ['(' num2str(num_set(idx(1)))]; num3 = [num2str(num_set(idx(2))) ')']; num4 = num2str(numD); 
                    operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
                else
                    num1 = num2str(numD); num2 = num2str(numA); num3 = ['(' num2str(num_set(idx(1)))]; num4 = [num2str(num_set(idx(2))) ')'];  
                    operand1 = sign_set(3); operand2 = sign_set(1); operand3 = sign_set(2);
                end
            elseif dice == 11
                while numD > 99 || numD < 1 || numA > 99 || numA < 1 
                    numB = randi([3 6]);
                    numC = randi([3 9]);
                    numA0 = randi([31 99]);
                    numA = numA0 * numB;
                    ans = randi([0 9]);
                    numD = numC*((numA/numB)-ans);
                end
                sign_set = ['/' '-' '/'];
                num1 = num2str(numA); num2 = num2str(numB); num3 = num2str(numD); num4 = num2str(numC); 
                operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
            elseif dice == 12
                while numD > 99 || numD < 1 || numA > 99 || numA < 1 
                    numA = randi([10 99]); 
                    numB = randi([3 9]);
                    numC = randi([3 6]);
                    ans = randi([0 9]);
                    numD = ((numA*numB)+ans)*numC;
                end
                sign_set = ['/' '-' 'x'];
                num1 = num2str(numD); num2 = num2str(numC); num3 = num2str(numA); num4 = num2str(numB); 
                operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
            elseif dice == 13 
                while numD > 99 || numD < 1 || numC > 99 || numC < 1 
                    numA = randi([10 99]); 
                    numB = randi([3 6]);
                    numC0 = randi([10 99]);
                    numC = numC0*numB;
                    ans = randi([0 9]);
                    numD = ((numA*numC)/numB)-ans;
                end
                sign_set = ['x' '/' '-'];
                num1 = num2str(numC); num2 = num2str(numA); num3 = num2str(numB); num4 = num2str(numD); 
                operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
            elseif dice > 13 && dice < 17
                while numD > 99 || numD < 1
                    numA = randi([10 99]);
                    numB = randi([10 99]);
                    numC = randi([10 99]);
                    ans = randi([0 9]);
                    numD = numA + numB + numC - ans;
                end
                num_set = [numA numB numC];
                sign_set = ['+' '+' '-'];
                idx = randperm(numel(num_set));
                ng_pos = randi([1 3]);
                if ng_pos == 1
                    num1 = num2str(num_set(idx(1))); num2 = num2str(num_set(idx(2))); num3 = num2str(num_set(idx(3))); num4 = num2str(numD); 
                    operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
                elseif ng_pos == 2
                    num1 = num2str(num_set(idx(1))); num2 = num2str(num_set(idx(2))); num3 = num2str(numD); num4 = num2str(num_set(idx(3))); 
                    operand1 = sign_set(1); operand2 = sign_set(3); operand3 = sign_set(2);
                else
                    num1 = num2str(num_set(idx(1))); num2 = num2str(numD); num3 = num2str(num_set(idx(2))); num4 = num2str(num_set(idx(3))); 
                    operand1 = sign_set(3); operand2 = sign_set(1); operand3 = sign_set(2);
                end
            elseif dice > 16 && dice < 23
                while numD > 99 || numD < 1
                    numA = randi([10 99]);
                    numB = randi([10 99]);
                    numC = randi([10 99]);
                    ans = randi([0 9]);
                    numD = numA + numB - numC - ans;
                end
                num_set1 = [numA numB]; num_set2 = [numC numD];
                sign_set = ['+' '-' '-'];
                idx1 = randperm(numel(num_set1)); idx2 = randperm(numel(num_set2));
                ng_pos = randi([1 3]);
                if ng_pos == 1
                    num1 = num2str(num_set1(idx1(1))); num2 = num2str(num_set1(idx1(2))); num3 = num2str(num_set2(idx2(1))); num4 = num2str(num_set2(idx2(2))); 
                    operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
                elseif ng_pos == 2
                    num1 = num2str(num_set1(idx1(1))); num2 = num2str(num_set2(idx2(1))); num3 = num2str(num_set1(idx1(2))); num4 = num2str(num_set2(idx2(2))); 
                    operand1 = sign_set(2); operand2 = sign_set(1); operand3 = sign_set(3);
                else
                    num1 = num2str(num_set1(idx1(1))); num2 = num2str(num_set2(idx2(1))); num3 = num2str(num_set2(idx2(2))); num4 = num2str(num_set1(idx1(2))); 
                    operand1 = sign_set(2); operand2 = sign_set(3); operand3 = sign_set(1);
                end
           else
                while numD > 99 || numD < 1
                    numA = randi([10 99]);
                    numB = randi([10 99]);
                    numC = randi([10 99]);
                    ans = randi([0 9]);
                    numD = numA - numB - numC - ans;
                end
                num_set = [numB numC numD];
                sign_set = ['-' '-' '-'];
                idx = randperm(numel(num_set));
                num1 = num2str(numA); num2 = num2str(num_set(idx(1))); num3 = num2str(num_set(idx(2))); num4 = num2str(num_set(idx(3))); 
                operand1 = sign_set(1); operand2 = sign_set(2); operand3 = sign_set(3);
            end
        otherwise
            warning('Unexpected level of difficulty');
    end
    finalAnswer = ans;

  3. #3
    Antoane
    Responsable technique

    Re : Test de stroop sous Matlab

    Bonjour,

    J'imagine que tu vas utiliser un GUI.
    Tu peux alors utiliser la fonction @rand pour choisir couleurs et mots à afficher.
    La mise à jour peut se faire directement depuis le call-back des boutons utilisés par l'utilisateur.
    La mesure du temps de réponse peut se faire à partir des instructions tic/toc ou @clock.


    Personnellement, je n'étudie pas un code non-commenté
    Deux pattes c'est une diode, trois pattes c'est un transistor, quatre pattes c'est une vache.

Discussions similaires

  1. Sous matlab
    Par invitebe397382 dans le forum Programmation et langages, Algorithmique
    Réponses: 0
    Dernier message: 04/05/2012, 14h32
  2. test adf sous matlab
    Par invite1c11a5c3 dans le forum Logiciel - Software - Open Source
    Réponses: 0
    Dernier message: 14/03/2011, 01h11
  3. fft sous matlab
    Par invite1178bc9c dans le forum Logiciel - Software - Open Source
    Réponses: 10
    Dernier message: 13/12/2009, 18h23
  4. Matlab 6 sous mac OS X
    Par invite751f915c dans le forum Logiciel - Software - Open Source
    Réponses: 0
    Dernier message: 03/06/2004, 09h25