MATLAB Python

handleStimulus

Syntax

[stimmap, stim_id, stim] = handleStimulus(stimmap, stim, strict) DESCRIPTION HANDLESTIMULUS is an internal function for performing lookups and organization using stimuli in easy* functions. If a supplied stimulus is not found in the stimmap for the corresponding id or string, the stimmap will be updated accordingly. The stimmap and stim arguments are both required with each call to HANDLESTIMULUS. USAGE [stimmap, stim_id, stim] = handleStimulus(stimmap, stim) takes a stimulus map prepared by makeMap, as well as a stimulus identifier, stim, which may be either a string or integer (stim id). The function uses stim as a lookup value within stimmap and adds the stimulus to the table if it does not already exist. It returns the updated stimmap as well as stim and stim_id values. [...] = handleStimulus(stimmap, stim, stim_descriptor) behaves as above, but using takes a both a stimulus string and stimulus id (it does not matter which is the stim and which is descriptor). The function searches for a lookup value that matches both inputs, and throws an error if a match is found to one but not both values. [...] = handleStimulus(stimmap, stim, stimid, strict) behaves as above, but also takes the boolean "strict", which when set to true, will cause the function to throw an error when no match is found (rather than adding values to the table). The variable stimid can be left empty if desired. OUTPUT stimmap: the initial condmap which may have additional entries when cond was not found for a particular condition factor. stim_id: the stimulus id of the submitted stimulus cond_str: a string representation of the input cond.