Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
lvqiancn

Junior Member
Registered:
Posts: 3
Reply with quote  #1 

Hi all,

I am using ML2 (Jan-14-2019) to write a reversal learning task. I used the block-selection-function to define 2 blocks, in which reward related choices are reversed. During my test, the programme continiously selected block 1 OR block2. it seems that the block-selection-function only runs when the programme starts, dose not run before each trial.

below is my block selection function.
--------------------------------------------------------------------
function block_label= blockselection(TrialRecord)
a=ones(20,1);
b=2*ones(20,1);
block_list=[a;b;a;b;a];
if block_list(TrialRecord.CurrentTrialNumber+1)==2
block_label=2;
else
block_label=1;
end
return

--------------------------------------------------------------------

0
Jaewon

Administrator
Registered:
Posts: 933
Reply with quote  #2 
Did you register the function as the block change function as well? If it is not the block change function, it is evaluated only when a block is finished.
0
lvqiancn

Junior Member
Registered:
Posts: 3
Reply with quote  #3 
Hi Jaewon,

Thanks for your reply. I have registered the function as the block selection function, not as the block change function.Dose the block selection function run before each trial?
block_selection function.png 


0
Jaewon

Administrator
Registered:
Posts: 933
Reply with quote  #4 
To run the function every trial, you need to make it both block selection function AND block change function.
ftp://helix.nih.gov/lsn/monkeylogic/ML2_doc/taskflowcontrol.html

In that case, the function should return 0, if you want the block to continue, or a block number, if you want to change the block.
0
lvqiancn

Junior Member
Registered:
Posts: 3
Reply with quote  #5 
thanks, it works.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.