/Posner-protocol

A simple posner protocol in MATLAB

Primary LanguageMatlab

This protocol conducts a simple Posner experiment, and stores the resulting data in two separated matrices.

For those unfamilliar with the protocol, this experiment will create a grid of rectangles (default to 16), and then present a visual cue in one of the rectangles at random. After that, the target will appear somewhere on the grid. In the "valid trials", the target will appear in the same rectangle that the visual cue, and in the "invalid trials" it will appear in any other rectangle at random. The participant has to be looking at the center of the figure for the entire time, and the idea is that valid trials will have shorter response times than invalid trials, due to the attention shifting place in the latter. The delay between the cue and the target will be either 100 or 300 ms, at random.

The protocol will firstly create the figure and present the instructions for the experiment. After that, a big cross will appear in the center of the figure for a set amount of time (default to 5s). Then, the script will call the function "protocol", which contains a loop for all the 1280 trials (in order to collect approx. 80 trials per possible location of the cue, and thus approx. 20 for each combination of conditions). In each iteration of the loop, two separated random numbers are generated: one for the delay (100/300) and one for the condition (valid/invalid). Depending on the numbers, the function will call one of the two subfunctions "valid_trial" and "invalid_trial", and collect the data of each trial in the corresponding matrix. At the end, the preallocated matrices will be filtered to a final matrix to get rid of all the exceeding rows in the preallocated matrices.