Nested while loops for populating lists


Author
Message
kev_dent
kev_dent
Partner Member (820 reputation)Partner Member (820 reputation)Partner Member (820 reputation)Partner Member (820 reputation)Partner Member (820 reputation)Partner Member (820 reputation)Partner Member (820 reputation)Partner Member (820 reputation)Partner Member (820 reputation)
Group: Forum Members
Posts: 47, Visits: 153
I'm trying to use nested while loops to prepopulate a bunch of lists that subsequently go on to control the properties of the stimuli in an experiment.
Here is a version of the code I'm working with. I can't seem to get it to work. Am I doing something wrong?
Any suggestions welcome.

<expt main>
/ onexptbegin = [
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
    
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
    
    var tcounter =0;
    
    while (CT1pos <2);
    {
    WT1pos =     100*(CT1pos +3);
    CT1pos +=1;
    
    while (Crotatet <2);
    {
    Wrotatet =     30*(Crotatet -0.5);
    Crotatet +=1;
    
        while (Cemotion<3);
        {
        Wemotion =     (Cemotion +1);
        Cemotion +=1;
    
            while (Csaliency<2);
            {
            Wsaliency =     (Csaliency +1);
            Csaliency +=1;
            
                while (CT2lag<2);
                {
                WT2lag =     (CT2lag*500)+200;
                CT2lag +=1;
                
                    while (CT1gender<2);
                    {
                    WT1gender =     (CT1gender +1);
                    CT1gender +=1;
                    {
                        while (CT2gender<2);
                        
                        WT2gender =     (CT2gender +1);
                        CT2gender +=1;
                        tcounter +=1;
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Reading This Topic

Explore
Messages
Mentions
Search