create_sequence_210311_BSJL.m 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. function [sequence_ready distrot] = create_sequence_210311_BSJL(nobject, nrot, contestdif, nblocks)
  2. %This function is made for the firs version of Memoreye. Compare to
  3. %Pingball, all trials would be CONCRETE.
  4. %This function combine part of code written by B. Spitzer and J.
  5. %Linde-Domingo
  6. %We will obtainend a matrix where each row is a trial and each column:
  7. % Column 1 = Object 1
  8. % Column 2 = Object 2
  9. % Column 3 = Rotation Object 1
  10. % Column 4 = Rotarion Object 2
  11. % Column 5 = Target: 1 or 2
  12. % Column 6 = Target Object (id)
  13. % Column 7 = Type of task (1= concrete/perceptual; 2=continuous/abstract)
  14. % Column 8 = Object memory test
  15. % Column 9 = Rotation Object memory test
  16. % Column 10 = Block number
  17. % Column 11 = Rotation target
  18. % Column 12 = Testing uncued (True / False)
  19. % Column 13 = Object memory test 2
  20. % Column 14 = Rotation Object memory test 2
  21. % Column 15 = Rotation UNCUED
  22. % % nrot=16
  23. % % contestdif=3.5
  24. % % nobject=3
  25. % % nblocks=8
  26. %% ~ Original B's code -
  27. %smallest unit
  28. noris=nrot; %- CHANGE THIS, REASON: HARD CODING -
  29. ori1=repmat([1:noris]',noris,1); % cued
  30. ori2=sort(ori1); % uncued
  31. %double it
  32. ori1=repmat(ori1,2,1); % cued
  33. ori2=repmat(ori2,2,1); % uncued
  34. %one set with uncued-test, the other without
  35. unctest=[ones(noris^2,1); zeros(noris^2,1)];
  36. ntrials=length(unctest);
  37. %quasi uniform allocation of pictures 1-3
  38. pairs=nchoosek(1:nobject,2);
  39. pairs=[pairs;[pairs(:,2),pairs(:,1)]];
  40. stim1=repmat(pairs(:,1),86,1); % make this vector slightly 'too long' - CHANGE THIS, REASON: HARD CODING -
  41. stim2=repmat(pairs(:,2),86,1);
  42. % randomize (and shorten
  43. pe=randperm(ntrials);
  44. stim1=stim1(pe);
  45. stim2=stim2(pe);
  46. % independently balance and randomize presentation as S1 or S2
  47. presord=[ones(noris^2,1); 2*ones(noris^2,1)];
  48. presord=presord(randperm(ntrials));
  49. %assemble stimulus set
  50. trials=[ori1 stim1 ori2 stim2 unctest presord];
  51. % and randomize trial order
  52. trials=trials(randperm(ntrials),:);
  53. %% Modifying the variable "trials" to match the output matrix (see line 8)
  54. distrot=360/nrot;
  55. listofrotations=(distrot/2):distrot:(360-(distrot/2));
  56. trialsperblock=size(trials,1)/nblocks;
  57. for ttt = 1:size(trials,1)
  58. % Column 1 = Object 1
  59. % Column 2 = Object 2
  60. % Column 3 = Rotation Object 1
  61. % Column 4 = Rotarion Object 2
  62. % Column 5 = Target: 1 or 2
  63. % Column 6 = Target Object (id)
  64. % Column 7 = Type of task (1= concrete/perceptual; 2=continuous/abstract)
  65. % Column 8 = Object memory test
  66. % Column 9 = Rotation Object memory test
  67. % Column 10 = Block number
  68. % Column 11 = Rotation target
  69. % Column 12 = Testing uncued (True / False)
  70. % Column 13 = Object memory test 2
  71. % Column 14 = Rotation Object memory test 2
  72. % Column 15 = Rotation UNCUED
  73. trials_recon(ttt,5) = trials(ttt,6); % Column 5 = Target: 1 or 2
  74. if trials(ttt,6) == 1 % If the cued item is presented first
  75. f_col_id = 2; % column for 1st item id
  76. f_col_rot = 1; % column for 1st item rot
  77. s_col_id = 4 ;% column for 2nd item id
  78. s_col_rot = 3; % column for 2nd item rot
  79. elseif trials(ttt,6) == 2 % If the cued item is presented second
  80. f_col_id = 4; % column for 1st item id
  81. f_col_rot = 3; % column for 1st item rot
  82. s_col_id = 2; % column for 2nd item id
  83. s_col_rot = 1; % column for 2nd item rot
  84. end
  85. trials_recon(ttt,1) = trials(ttt,f_col_id); % Column 1 = Object 1 (item presented 1st)
  86. trials_recon(ttt,2) = trials(ttt,s_col_id); % Column 2 = Object 2 (item presented 1st)
  87. trials_recon(ttt,3) = listofrotations(trials(ttt,f_col_rot)); % Column 3 = Rotation Object 1
  88. trials_recon(ttt,4) = listofrotations(trials(ttt,s_col_rot)); % Column 4 = Rotarion Object 2
  89. trials_recon(ttt,6) = trials(ttt,2); % Column 6 = Target Object - CUE (id)
  90. trials_recon(ttt,7) = 1; % Column 7 = Type of task (1= concrete/perceptual; 2=continuous/abstract) - HERE IT IS ALWAYS CONCRETE
  91. 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
  92. % Column 9 = Rotation Object
  93. % memory test (below)
  94. if randi([0, 1], [1, 1])
  95. trials_recon(ttt,9)= listofrotations(trials(ttt,1))+(distrot/contestdif);%target position + one test position
  96. else
  97. trials_recon(ttt,9)= listofrotations(trials(ttt,1))-(distrot/contestdif);%target position - one test position
  98. end
  99. trials_recon(ttt,10)= ceil(ttt/trialsperblock); % Column 10 = Block number (we will add this later)
  100. trials_recon(ttt,11)= listofrotations(trials(ttt,1));% Column 11 = Rotation target (CUE)
  101. trials_recon(ttt,12)= trials(ttt,5); %Column 12 = Testing uncued (True / False)
  102. trials_recon(ttt,13)= trials(ttt,4);% Column 13 = Object memory test 2 (it will be always the same uncued item)
  103. % Column 14 = Rotation Object memory test 2
  104. if randi([0, 1], [1, 1])
  105. trials_recon(ttt,14)= listofrotations(trials(ttt,3))+(distrot/contestdif);%target position + one test position
  106. else
  107. trials_recon(ttt,14)= listofrotations(trials(ttt,3))-(distrot/contestdif);%target position - one test position
  108. end
  109. trials_recon(ttt,15)= listofrotations(trials(ttt,3)); % Column 15 = Rotation UNCUE
  110. end
  111. %Outputs
  112. sequence_ready = trials_recon;
  113. end