Drawing multiple letters on the screen efficiently

Hi, I’m having some trouble with the function Screen("DrawText"). I’m on Windows 10 with PTB version '3.0.16`.

Basically I need to circular arrange 20 letters on the screen like in the picture:

I’ve done it using computing the x and y coordinates (using a custom function) and then drawing all elements with a for loop inside the experiment:

% Screen Setup
    
screen_x_size = 1000;
screen_y_size = 800;
[w1, rect] = Screen('OpenWindow', 0, 0, [0 0 screen_x_size screen_y_size]);

% Experiment

for i = 1:20
    Screen('DrawText',w1, letters(i), circ_pos(i, 1),circ_pos(i, 2), 255);
end
Screen('Flip', w1);

WaitSecs(1);
sca;

Inside my matrix circ_pos I have all my coordinates. However, I’m worried about possible performance issues related to having a for loop each trial of my experiment. Does the Screen("DrawText") function can be used in a vectorized way? I’ve tried to put all my coordinates inside the function but didn’t work.

Why are you worried, have you measured that its a problem? Try timing that bit of code and see if there is reason to worry.

I’m not expert but I’ve read that vectorized operations are better especially within the experimental routine. Can you suggest me how to check timing issues?

put something like
t0 = GetSecs();
before the loop and then
elapsed = GetSecs()-t0; after the loop. will tell you how many seconds it took.