Getting Multiple responses/input using GetEchoString
Afficher commentaires plus anciens
Hi,
Does anyone knows how can I get multiple responses with GetEchoString, and making the previous responses stay on the screen at the same time. I tired these codes (refer below), it works out fine for getting the responses, but the previous response just vanish whenever I start typing the second response. Please help. Thanks in advance.
for Length=1:initial_length
check_answer = str2mat(wordpool(wordset2))
Response = GetEchoString_VSmod(wPtr, text, 500, 100, textBlack, white,Length);
% I modified the positioning of my output here, that is why the function is now
called differently
Screen('DrawText', wPtr, text, 500, 100, textBlack);
Screen('DrawLine',wPtr,[0 0 0], 640, (Length*150)+140, 1040 ,(Length*150)+140, 5);
Screen('DrawText', wPtr, Response, 650, (Length*150)+40, textBlack)
vbl=Screen('Flip', wPtr, vbl+(flipSpd*monitorFlipInterval),1);
end
This is my modified GetEchoString
FlushEvents('keyDown');
% Write the message
Screen('DrawText', windowPtr, msg, x, y, textColor, bgColor);
Screen('DrawLine',windowPtr,[0 0 0], 640, (Length*150)+140, 1040 ,(Length*150)+140, 5);
Screen('Flip', windowPtr, 0, 1);
string = '';
while true
char = GetChar;
switch (abs(char))
case {13, 3, 10}
% ctrl-C, enter, or return
break;
case 8
% backspace
if ~isempty(string)
string = string(1:length(string)-1);
end
otherwise
string = [string, char];
end
output = [msg, ' ', string];
Screen('DrawText', windowPtr, msg, x, y, textColor, bgColor);
Screen('DrawLine',windowPtr,[0 0 0], 640, (Length*150)+140, 1040 ,(Length*150)+140, 5);
Screen('Flip', windowPtr, 0, 1);
Screen('DrawText', windowPtr, string, 650, (Length*150)+40, textColor, bgColor);
Screen('Flip', windowPtr);
end
Réponses (1)
Daniel Shub
le 28 Déc 2011
Screen('DrawText', wPtr, Response, 650, (Length*150)+40, textBlack)
I think you want to concatenate your new Response with your old Response.
Catégories
En savoir plus sur Installation and Operational Settings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!