MATLAB Python

dataBind

Syntax

outputDatastruct = dataBind(datastruct, aux_name, aux_data, timestamps, aux_onset)

Description

Call this function to integrate auxiliary data into an easy function datastruct. The auxiliary data could for example be output from an eyetracker, fMRI scanner, or a virtual reality experiment. This function takes the supplied data and temporally synchronizes the data with trials contained in the supplied datastruct before appending the relevant information to the datastruct trials table.

Usage

outputDatastruct = dataBind(datastruct,aux_name,aux_data,timestamps, aux_onset) returns a datastruct identical to the input datastruct except with aux_data transformed into a timeseries object with timestamps shifted so that 0 corresponds to the experiment onset. datastruct: an output struct from an easy function such as easyKeys or easyScale. aux_name: the desired name for the auxiliary data to be displayed in the aux_data field of the outputDatastruct. aux_data: the data in the form of a numeric matrix which needs to be synchronized and linked to the datastruct trials table, and can have any non-zero number of dimensions. There must be at least three samples, and samples must be along the first dimension (i.e., the first dimension of 'aux_data' must align with the 'timestamps' vector'). timestamps: a numeric vector of system clock times which specify the points at which the auxiliary device was sampled. These points will be used to link the data with specific trials in the datastruct. 'timestamps' must have equal length to the first dimension (rows) of the 'aux_data' matrix. 'timestamps' can alternatively be provided as a 2-element vector with the first element being onset time and the second being sampling frequency in Hertz. In this case, the timestamps vector will be automatically generated. aux_onset: the clock onset time of the auxiliary device that corresponds to the experiment start time as reported in the datastruct. If this parameter is supplied as an empty array ([]), the time recorded in datastruct.params.exp_onset will be used.

Output

outputDatastruct: a datastruct containing a new field 'aux_data' which will have a field for each set of auxiliary data bound to the input datastruct. Each of these auxiliary data sets contains a timeseries object which holds the time and data information of the set.