This Gitlab instance will be briefly unavailable today from 19:15 CET onwards for maintenance reasons.
Diese Gitlab-Instanz wird heute ab 19:15 Uhr kurzzeitig nicht verfügbar sein aufgrund von Wartungsarbeiten.
@@ -82,18 +82,38 @@ Several functions of this toolbox are part of one of two modes: human and animal
...
@@ -82,18 +82,38 @@ Several functions of this toolbox are part of one of two modes: human and animal
Very simple experiments (especially for testing purposes) can be coded within one single script by calling functions of this toolbox. Generally, you can call functions of the toolbox one by one each by itself. Some functions, however, depend on the call of other functions before (see [function tree](function-tree)).
Very simple experiments (especially for testing purposes) can be coded within one single script by calling functions of this toolbox. Generally, you can call functions of the toolbox one by one each by itself. Some functions, however, depend on the call of other functions before (see [function tree](function-tree)).
Functions that you will have to use in every single script are
Functions that you will have to use in every single script are
• [initOTBR ](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/initOTBR.m)(3.3) to initialize the toolbox and
• [initOTBR ](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/initOTBR.m)(3.3) to initialize the toolbox and
• [stopExperiment](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/stopExperiment.m)(3.5.) to close the toolbox and reset all defined IO pins related to the toolbox.
• [stopExperiment](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/stopExperiment.m)(3.5.) to close the toolbox and reset all defined IO pins related to the toolbox.
Other essential functions include:
Other essential functions include:
• [initWindow](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/initWindow.m)(4.1.) to initialize the presentation window for every visual stimulus display (text, images, videos);
• [initWindow](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/initWindow.m)(4.1.) to initialize the presentation window for every visual stimulus display (text, images, videos);
• [keyBuffer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/keyBuffer.m)(9.2.) that is the main function used for behavioral in- and output during animal experiments, it can also be used to code waiting periods or inter-trial intervals (you can also use the Psychophysics toolbox function WaitSecs for that);
• [keyBuffer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/keyBuffer.m)(9.2.) that is the main function used for behavioral in- and output during animal experiments, it can also be used to code waiting periods or inter-trial intervals (you can also use the Psychophysics toolbox function WaitSecs for that);
• [getAnswer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/getAnswer.m)(9.3.) has a similar usage and is better designed to be used in human experiments (also useful: getButtonClick (9.5.));
• [getAnswer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/getAnswer.m)(9.3.) has a similar usage and is better designed to be used in human experiments (also useful: getButtonClick (9.5.));
• bIO (10.1.) which is the most basic function to control external devices for e.g. feeding and punishment in animal experiments (more fine-grained functions for specific uses only: feeding, punishment (10.2., 10.3.)).
• bIO (10.1.) which is the most basic function to control external devices for e.g. feeding and punishment in animal experiments (more fine-grained functions for specific uses only: feeding, punishment (10.2., 10.3.)).
Furthermore, two very useful functions are:
Furthermore, two very useful functions are:
• [save2File](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/save2File.m)(11.3.) to save all your workspace variables in a MATLAB file and
• [save2File](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/save2File.m)(11.3.) to save all your workspace variables in a MATLAB file and
• [errorSave](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/errorSave.m)(11.1.) that, in case of an error, still saves all variables and returns an error warning (needs to be called in a try-catch statement).
• [errorSave](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/errorSave.m)(11.1.) that, in case of an error, still saves all variables and returns an error warning (needs to be called in a try-catch statement).
## Simple example
One simple example of a code that you can directly copy into your myExperiment.m file to try out simple functions of the toolbox (after adjusting myHardwareSetup and myParadigmSetup). Before trying out this example make sure that MATLAB’s working directory is correctly set to your experimental folder. It displays a text on the screen, waits for one second and closes the window and toolbox again.
The second advanced example will display a text and the toolbox will wait for 10 seconds or until the proper response (pressing key ’1’) has been made using the [keyBuffer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/keyBuffer.m) function. After that depending on if a response has been made one of two text will be displayed followed by a one second waiting period. This is implemented by using a simple if statement and the output from [keyBuffer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/keyBuffer.m)(see section 9.2. for clarification). Then the window and toolbox will be closed. Make sure to only press key ‘1’ when you are enabled to (during the ten second period when [keyBuffer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/keyBuffer.m) is running).
This example makes use of the function keyBuffer, which is used for animal experiments mostly. Because you have no hardware like response keys or IO devices installed you can use the keyboard to test your experiments. The keyboard as response device is defined in myHardwareSetup.m in section 2 by default. If you would like to use an IO hardware device that is supported by our toolbox all you have to do is change the setting in section 2 and make sure the response keys is connected to pin 1 (or input 1).
The third example shows a similar experiment using the function getAnswer, which is mostly used in human experiments. In this example the program asks the user to press a key and presents the pressed key on the screen.
All examples use two computer monitors. If you want to run it on only one monitor, you have to delete the ‘(2)’ behind [initWindow](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/initWindow.m). We recommend using two computer screens if possible. This allows to program in MATLAB or Octave on one screen and see the results on the second screen.
Depending on your device initWindow and [closeWindow](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/closeWindow.m) may need some time to run. This means in an actual experiment when exact timing matters call the window initialization before the actual start of the experiment.