MOLE Modifiable Language Experiments

printInstructions Instructions


This function takes a text file of pre-written instructions and prints them to the screen so the subject can see them.


This function will take the specified text file (instrfile) and will print it to the specified screen/window (winPtr).  The instructions themselves will be loaded into an array, and then lines of that array will be printed to the screen, but will not be shown to subjects until the screen is flipped.

You can specify a key to be pressed (or the mouse to be clicked) to move on after reading the instructions via the ‘key‘ argument.  The current default for key press is space bar.

This function also allows for text display characteristics to be altered if the experimenter desires.  The text height (size), text color, and background color of the screen can all be altered via the 3-element vector that specifies colors.  The current defaults, respectively, are 20, pink, and white.



Ex.  printInstructions(‘ExpAInstructions’,5,’mouse’,50,[0 206 209],[240 128 128])

OR (this is the same function as the one listed above, only using the defined variable names listed below in the Arguments section):

Ex.  printInstructions(arg1,arg2,arg3,arg4,arg5,arg6)


instrfile:  The name of the text file of instructions to be loaded.
Ex.  arg1 = ‘ExpAInstructions’

winPtr:  Numerical value designating which window the instructions are going to be printed to.
Ex.  arg2 = 5

key:  Specifies which key is to be pressed in order to advance from the instructions.  The default is SPACE (the spacebar key).  Can also be specified as ‘mouse‘ to advance with a mouse click, as opposed to a key press.
Ex.  arg3 = ‘mouse’
Ex.  arg3 = ‘a’

textHeight:  Numerical value that designates the size of the text to be printed to the screen.  If no value is entered, textHeight defaults to 20.
Ex.  arg4 = 50

textColor:  Numerical 3-element vector that designates the color of the instructions text to be printed to the screen.  If no value is entered, textColor defaults to pink [255 0 255].
Ex.  arg5 = [0 206 209]
Specifies the text color to be dark turquoise.

bgColor:  Numerical 3-element vector that designates the color of the background screen for the instructions to be printed on.  If no value is entered, bgColor defaults to white [255 255 255].
Ex. arg6 = [240 128 128]
Specifies the background color to be light coral.


This function works only with PsychToolbox installed.

This function will not wrap text; carriage returns must be present in instrfile.

All strings fed to the function must be entered surrounded by single quotation marks ( ‘ ‘ ).

Google can be used to find 3-element vector color codes (RGB codes) easily.

All string inputs are case sensitive.

All vectors must be surrounded by brackets ( [ ] ).


If you would like to download this read-me to your computer, you can do so below (right-click and ‘Save As’).


Comments are closed.

Post Navigation