Info

此问题已关闭。 请重新打开它进行编辑或回答。

How can I assign Keyboard keys to colours?

1 次查看(过去 30 天)
Barbara Fiorani
Barbara Fiorani 2020-10-27
关闭: Walter Roberson 2020-10-29
Hi,
I need to assign colours to Kb names as I am creating a stroop task script with Psychtoolbox.
This is a part of my script:
WordList = {'blanket', 'garage', 'shampoo', 'handle', 'sofa', 'curtain', 'switch', 'bathroom', 'vase', 'hallway', 'duster', 'lounge'};
rgbColors = [1 0 0; 0 1 0; 0 0 1];
rng('shuffle')
%Improve portability of the code acorss operating systems
KbName('UnifyKeyNames');
% Specify key names of interest
activeKeys = [KbName('LeftArrow') KbName('RightArrow') KbName('UpArrow') KbName('Space')];
% Restrict the keys for keyboard input to the keys we want
RestrictKeysForKbCheck(activeKeys);
% Suppress echo to the command line for keypresses
ListenChar(2);
%Assign Kb to colours ??????????
How can i pair the Kb with colours? For example, if it appear a word in yellow the participant has to press Kb 'Uparrow' and so forth.

回答(0 个)

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by