Hi guys, hopefully someone may be able to help.
Basically, I am planning to run an experiment using MATLAB with the Psychtoolbox plugin. I won't go into too many details, and just outline what i need MATLAB and Psychtoolbox to do for me.
I have 16 different word lists stored in a single text file. Each word list has 15 words. So essentially it is arranged 15 rows x 16 columns as i understand it. I need MATLAB/Psychtoolbox to present the first row, word by word, and then ask participants to type in as many of the words as they can remember from that list within a certain time frame. And following this, do the same with row 2, then row 3 etc....
I do have some MATLAB code to show which maybe entirely wrong, or may be close. But i am hoping someone may be able to help out.
Here is the code - apoligies if this takes up a lot of space on the page:
NumWords = 15; %Number of words to present
NumRows = 16;
NumCols = 15;
wordDelimiter=' ';
Duration = 1.5 ; %Duration of presentation
ISI = 0.1; %Inter stimulus interval
X = 1366; %Screen resolution
Y = 768;
InputFile = 'Exp_1_studylist_A.txt'; %Open and read in word file
fileID = fopen(InputFile);
Words = textscan (fileID , '%s');
fclose(fileID);
Screen('Preference', 'SkipSyncTests', 2 ); %Setup psychotoolbox
win = Screen('OpenWindow',0,[],[0,0,X,Y]); %Open window
%Set text etc
Screen('TextSize',win, 24 );
Screen('TextFont',win,'times');
Screen('TextStyle', win, 0);
DrawFormattedText(win, 'Press any key to start.' , 'center', 'center' ); %Write word to screen
Screen(win,'Flip');% present to the screen
KbWait; %Wait for keyboard response
for j = 1 : NumWords ; % outerloop is carried out 'NumRows' times, and for each of these the inner loop is carried out 'NumCols' times
DrawFormattedText(win, Words{1}{j}, 'center', 'center' ); %Write word to screen
Screen(win,'Flip');% present to the screen
WaitSecs(Duration);
Screen('FillRect', win ); %clear Screen
Screen(win,'Flip');
KbWait;
WaitSecs(ISI);
end;
DrawFormattedText(win, 'Thank you. Press any key to exit.' , 'center', 'center' ); %Write word to screen
Screen(win,'Flip');% present to the screen
KbWait; %Wait for keyboard response
sca;% Screen Close All
At the moment, this just runs through the text file without stopping, so just presents word after word until the end.
Any advice would be amazing
Best,
Niall