MATLAB Python

keyCheck

Syntax

[new_valid_keys, valid_keycode, new_cresp_keys, cresp_keycode] = keyCheck(valid_keys [,cresp_keys] [,strict]) [] = optional parameters

Description

KEYCHECK is a function called by various SuperPsychToolbox scripts to check that the set of "valid" keys and subset of "correct" keys are good. It also returns keycode maps for valid and cresp keys.

Usage

valid_keys: a cell array of string names indicating the keys to be represented as "allowed" keys. cresp_keys: a cell array of string names indicating the keys to be represented as "correct" keys. Must be a subset of valid_keys. Where null responses are counted as correct, nan should be specified. strict: when set to true, function will only consider exact key matches (e.g., will match '3' to match the key '3' but not the key '3#').

Output

new_valid_keys: a screened version of valid_keys, inspected, approved and properly formatted by the script. valid_keycode: a 256-element numeric array corresponding to the keycode representation of new_valid_keys. new_cresp_keys: a screened version of cresp_keys, inspected, approved and properly formatted by the script. cresp_keycode: a 256-element numeric array corresponding to the keycode representation of new_cresp_keys.