Differences

This shows you the differences between two versions of the page.

Link to this comparison view

mgl:taskreference [2013/08/02 07:01]
mgl:taskreference [2015/01/19 15:36]
Line 313: Line 313:
 If you want the second interval to be randomized over the interval 2-2.5 seconds in intervals of 0.1 seconds (i.e. you want it to be either 2,​2.1,​2.2,​2.3,​2.4 or 2.5: If you want the second interval to be randomized over the interval 2-2.5 seconds in intervals of 0.1 seconds (i.e. you want it to be either 2,​2.1,​2.2,​2.3,​2.4 or 2.5:
  
-  task.segmin = [1.3 2]; +  task.segmin = [1.3 nan]; 
-  task.segmax = [1.3 2.5]; +  task.segmax = [1.3 nan]; 
-  task.segquant ​= [0 0.1];+  task.segdur{2} = [2:​0.1:​2.5];​ 
 + 
 +Or, if you want different durations with different probabilities (the above would make each of the segment durations equally possible: 
 + 
 +  task.segmin = [1.3 nan]; 
 +  task.segmax = [1.3 nan]; 
 +  task.segdur{2} = [1 2 8]; 
 +  task.segprob{2} = [0.8 0.1 0.1]; 
 + 
 +This would make the second segment have durations of either 1 2 or 8 seconds with the 1 second one having a probability of 0.8 and the others having 0.1 probability. You can also specify multiple segments to have different durations like: 
 + 
 +  task.segmin = [1.3 nan nan]; 
 +  task.segmax = [1.3 nan nan]; 
 +  task.segdur{2} = [2:0.1:2.5]; 
 +  task.segdur{3} = [1 2 8]; 
 +  task.segprob{3} ​= [0.8 0.1 0.1]; 
 + 
 +This would make segment 2 and segment 3 behave as in the above two examples.
  
 You can also have a segment wait until a backtick happens, so that you can easily synch to volumes, for example: You can also have a segment wait until a backtick happens, so that you can easily synch to volumes, for example:
Line 323: Line 340:
   task.synchToVol = [0 1];   task.synchToVol = [0 1];
  
-This will cause the second segment to last a random amount of time between 2 and 2.5 seconds and then wait until a backtick occurs before going on to the next trial.+This will cause the second segment to last a random amount of time between 2 and 2.5 seconds and then wait until a backtick occurs before going on to the next trial. Note that when using synchToVol it is a good idea to make the segment for which you are waiting for a volume acquisition to happen slightly shorter than you actually want. This way the segment time will be finished and it will be waiting for the volume acquisition to continue
  
 ===== How to wait for user input before moving to next segment ===== ===== How to wait for user input before moving to next segment =====
Line 422: Line 439:
   task.thistrial.whichButton   task.thistrial.whichButton
  
-This will get filled with which button was pressed (a number from 1-9). Note that if two keys are pressed down at the same time, it will only return the first in the list (e.g. if 1 and 2 are simultaneously pressed, it will return 1).+This will get filled with which button was pressed (a number from 1-9). Note that if two keys are pressed down at the same time, it will only return the first in the list (e.g. if 1 and 2 are simultaneously pressed, it will return 1). //​Caution//:​ whichButton is defined by the index of the button pressed in the list of possible buttons. If your button list is [1 2 3 4 5] and the user presses "​5",​ you will get back "​5"​. If your button list is [5] and the user presses "​5",​ you will get back "​1"​.
  
 If you want to get all the keys that are pressed, you can look at If you want to get all the keys that are pressed, you can look at