DrawFormattedText error using Psychtoolbox
Show older comments
I'm trying to set up a simple test experiment using Psychtoolbox, but I can't even get past showing my 3-line instructions on the screen with DrawFormattedText. This is my code:
% Set up the screen
clear all
close all
Screen('Preference','SkipSyncTests',1);
[win,screenRect]=Screen('OpenWindow',0,[127 127 127],[100 100 1000 800]);
% Instructions
tstring=["Blabla.\nBlabla.\nBlabla."];
[nx,ny]=DrawFormattedText(win,tstring,'center','center',[0 0 0]);
Screen('Flip',win)
% Close experiment
pause(3)
sca
However, when I try to run it, I get this error:
Index exceeds the number of array elements (1).
Error in DrawFormattedText (line 276)
tstring = [ tstring(1:min(newlinepos)-1) repchar tstring(min(newlinepos)+2:end)];
Error in Experiment (line 17)
[nx,ny]=DrawFormattedText(win,tstring,'center','center',[0 0 0]);
Accepted Answer
More Answers (0)
Categories
Find more on Image display and manipulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!