ScannerSyncMatlab222015-08-28 14:58:08RussellThompson212015-08-28 14:55:25RussellThompson202015-08-28 14:54:14RussellThompson192015-08-28 14:51:37RussellThompson182015-08-28 14:49:13RussellThompson172015-08-28 14:44:33RussellThompson162015-08-28 14:43:57RussellThompson152015-08-28 14:43:43RussellThompson142015-08-28 14:41:44RussellThompson132015-08-28 14:39:28RussellThompson122015-08-28 14:38:35RussellThompson112013-11-26 22:54:14kalm102013-11-26 22:53:23kalm92013-03-07 21:23:43localhostconverted to 1.6 markup82010-09-28 10:38:46AnnikaLinke72010-09-28 10:37:59AnnikaLinke62010-09-28 10:18:26AnnikaLinke52010-09-28 10:15:03AnnikaLinke42009-02-25 09:59:43RhodriCusack32009-02-25 09:59:01RhodriCusack22009-02-25 09:58:44RhodriCusack12009-02-25 09:58:32RhodriCusackNB - as of early 2015, the method of using scanner sync in matlab has changed. The new method uses Tibor's ScannerSynchClass rather than Rhodri's MRISync / ScannerSync softwareUsing ScannerSync from Matlab - NEW METHODOpen Matlab and check that the ScannerSynchClass is on the path, e.g. using: This should return the path to the ScannerSynchClass.m file. On the stim machines, this should be C:\Program Files\MATLAB\R2014a\toolbox\CBSU. If you get an error message like "ScannerSynchClass not found", try: Once the ScannerSynchClass is available, create an instance of the class: Once the instance has been created, you can use the class properties and methods to collect pulses and button box responses: Using ScannerSync from Matlab - OLD METHODMake sure you have the ScannerSync control installed. Somewhere near the top of your code, set up ScannerSync & initialise communication with the input-output board (will not work if you're using a machine without the board, e.g., not the mimic or stim delivery machines). Now, wait for first pulse from scanner. Also, tell ScannerSync the approximate TR. Wait for dummies (one less as StartExperiment command above will already have heard a pulse) In your trial loop, you'll need to spend some of the time listening for pulses You should dump out the timing of critical events and the measured TR Also, for some designs you may want to occasionally synchronise your trials to the scanner Using pretend modeIf you'd like to test code on a machine without the card, you may use a feature of ScannerSync called "pretend mode". To do this: (1) When in pretend mode, don't do "Initialise", and instead issue a "SetPretendMode" command. So change the first block to something like (2) You'll then see a warning message when you get to the "StartExperiment" command, to which you should click "OK". If you're using the PsychToolbox and have already set up the screen, make sure that you only use the HideCursor command after the StartExperiment command, otherwise you won't be able to click OK. If you would like to use the button box in the practice room of the Scanner building, you will need this code instead to make the button box work: Collecting ResponsesTo collect responses in matlab using the button box add a code similar to this: This will collect the responses made by the subject during a pre-defined time interval (rt_window). You can also need to define which buttons the subject should press (in this example they are called samekey and diffkey). The codes returned by pressing the buttons are 28, 26, 22, 14 (i.e. when the right hand is placed on the button box and the subject used his index finger the code returned will be 28). The GetResponse() function will by default only return first four button presses. If there is a need to use more than 4 buttons one could use GetResponseExtended() or ReadPIOValue(). The example below uses the latter function and ignores responses 254 and 255, which relate to no-response events. Collecting Response TimesTo collect RTs you could try the following: