function [sequence_ready distrot] = create_sequence_210311_BSJL(nobject, nrot, contestdif, nblocks) %This function is made for the firs version of Memoreye. Compare to %Pingball, all trials would be CONCRETE. %This function combine part of code written by B. Spitzer and J. %Linde-Domingo %We will obtainend a matrix where each row is a trial and each column: % Column 1 = Object 1 % Column 2 = Object 2 % Column 3 = Rotation Object 1 % Column 4 = Rotarion Object 2 % Column 5 = Target: 1 or 2 % Column 6 = Target Object (id) % Column 7 = Type of task (1= concrete/perceptual; 2=continuous/abstract) % Column 8 = Object memory test % Column 9 = Rotation Object memory test % Column 10 = Block number % Column 11 = Rotation target % Column 12 = Testing uncued (True / False) % Column 13 = Object memory test 2 % Column 14 = Rotation Object memory test 2 % Column 15 = Rotation UNCUED % % nrot=16 % % contestdif=3.5 % % nobject=3 % % nblocks=8 %% ~ Original B's code - %smallest unit noris=nrot; %- CHANGE THIS, REASON: HARD CODING - ori1=repmat([1:noris]',noris,1); % cued ori2=sort(ori1); % uncued %double it ori1=repmat(ori1,2,1); % cued ori2=repmat(ori2,2,1); % uncued %one set with uncued-test, the other without unctest=[ones(noris^2,1); zeros(noris^2,1)]; ntrials=length(unctest); %quasi uniform allocation of pictures 1-3 pairs=nchoosek(1:nobject,2); pairs=[pairs;[pairs(:,2),pairs(:,1)]]; stim1=repmat(pairs(:,1),86,1); % make this vector slightly 'too long' - CHANGE THIS, REASON: HARD CODING - stim2=repmat(pairs(:,2),86,1); % randomize (and shorten pe=randperm(ntrials); stim1=stim1(pe); stim2=stim2(pe); % independently balance and randomize presentation as S1 or S2 presord=[ones(noris^2,1); 2*ones(noris^2,1)]; presord=presord(randperm(ntrials)); %assemble stimulus set trials=[ori1 stim1 ori2 stim2 unctest presord]; % and randomize trial order trials=trials(randperm(ntrials),:); %% Modifying the variable "trials" to match the output matrix (see line 8) distrot=360/nrot; listofrotations=(distrot/2):distrot:(360-(distrot/2)); trialsperblock=size(trials,1)/nblocks; for ttt = 1:size(trials,1) % Column 1 = Object 1 % Column 2 = Object 2 % Column 3 = Rotation Object 1 % Column 4 = Rotarion Object 2 % Column 5 = Target: 1 or 2 % Column 6 = Target Object (id) % Column 7 = Type of task (1= concrete/perceptual; 2=continuous/abstract) % Column 8 = Object memory test % Column 9 = Rotation Object memory test % Column 10 = Block number % Column 11 = Rotation target % Column 12 = Testing uncued (True / False) % Column 13 = Object memory test 2 % Column 14 = Rotation Object memory test 2 % Column 15 = Rotation UNCUED trials_recon(ttt,5) = trials(ttt,6); % Column 5 = Target: 1 or 2 if trials(ttt,6) == 1 % If the cued item is presented first f_col_id = 2; % column for 1st item id f_col_rot = 1; % column for 1st item rot s_col_id = 4 ;% column for 2nd item id s_col_rot = 3; % column for 2nd item rot elseif trials(ttt,6) == 2 % If the cued item is presented second f_col_id = 4; % column for 1st item id f_col_rot = 3; % column for 1st item rot s_col_id = 2; % column for 2nd item id s_col_rot = 1; % column for 2nd item rot end trials_recon(ttt,1) = trials(ttt,f_col_id); % Column 1 = Object 1 (item presented 1st) trials_recon(ttt,2) = trials(ttt,s_col_id); % Column 2 = Object 2 (item presented 1st) trials_recon(ttt,3) = listofrotations(trials(ttt,f_col_rot)); % Column 3 = Rotation Object 1 trials_recon(ttt,4) = listofrotations(trials(ttt,s_col_rot)); % Column 4 = Rotarion Object 2 trials_recon(ttt,6) = trials(ttt,2); % Column 6 = Target Object - CUE (id) trials_recon(ttt,7) = 1; % Column 7 = Type of task (1= concrete/perceptual; 2=continuous/abstract) - HERE IT IS ALWAYS CONCRETE trials_recon(ttt,8) = trials(ttt,2); % Column 8 = Object memory test CUE - HERE IT IS ALWAYS THE SAME COS IT IS A CONCRETE TASK % Column 9 = Rotation Object % memory test (below) if randi([0, 1], [1, 1]) trials_recon(ttt,9)= listofrotations(trials(ttt,1))+(distrot/contestdif);%target position + one test position else trials_recon(ttt,9)= listofrotations(trials(ttt,1))-(distrot/contestdif);%target position - one test position end trials_recon(ttt,10)= ceil(ttt/trialsperblock); % Column 10 = Block number (we will add this later) trials_recon(ttt,11)= listofrotations(trials(ttt,1));% Column 11 = Rotation target (CUE) trials_recon(ttt,12)= trials(ttt,5); %Column 12 = Testing uncued (True / False) trials_recon(ttt,13)= trials(ttt,4);% Column 13 = Object memory test 2 (it will be always the same uncued item) % Column 14 = Rotation Object memory test 2 if randi([0, 1], [1, 1]) trials_recon(ttt,14)= listofrotations(trials(ttt,3))+(distrot/contestdif);%target position + one test position else trials_recon(ttt,14)= listofrotations(trials(ttt,3))-(distrot/contestdif);%target position - one test position end trials_recon(ttt,15)= listofrotations(trials(ttt,3)); % Column 15 = Rotation UNCUE end %Outputs sequence_ready = trials_recon; end