trouble with the function 'Screen' running code with psychtoolbox

4 次查看(过去 30 天)
Hello everyone,
I am new to Matlab, but would like to use the code from a paper (Thaler, L., Schutz, A. C., Goodale, M. A., & Gegenfurtner, K. R. (2013). What is the best fixation target? The effect of target shape on stability of fixational eye movements. Vision Research, 76, 31-42.) to create a fixation cross in matlab using the psychtoolbox.
However, I have trouble running the code. I get an error message following the code.
Thank you for your help.
Juliane
________________
ERROR MESSAGE:
Error using Screen
Usage:
Screen('DrawLine', windowPtr [,color], fromH, fromV, toH, toV [,penWidth]);
Error in fix_cross_script (line 24)
Screen('DrawLine', w, colorCross, cx-d1/2 * ppd, cy, cx+d1/2 * ppd, cy, d2 * ppd);
_________________
clear all;
close all;
width = 39; % horizontal dimension of display (cm)
dist = 60; % viewing distance (cm)
colorOval = [0 0 0]; % color of the two circles [R G B]
colorCross = [255 255 255]; % color of the Cross [R G B]
d1 = 0.6; % diameter of outer circle (degrees)
d2 = 0.2; % diameter of inner circle (degrees)
screen = 0;
[w,rect] = Screen('OpenWindow', screen, [], []);
[cx, cy] = RectCenter(rect);
ppd = pi * (rect(3)-rect(1)) / atan(width/ dist/2) / 360; % pixel per degree
HideCursor;
WaitSecs(2);
Screen('FillOval', w, colorOval, [cx-d1/2 * ppd, cy-d1/2 * ppd, cx+d1/2 * ppd, cy+d1/2 * ppd], d1 * ppd);
Screen('DrawLine', w, colorCross, cx-d1/2 * ppd, cy, cx+d1/2 * ppd, cy, d2 * ppd);
Screen('DrawLine', w, colorCross, cx, cy-d1/2 * ppd, cx, cy+d1/2 * ppd, d2 * ppd);
Screen('FillOval', w, colorOval, [cx-d2/2 * ppd, cy-d2/2 * ppd, cx+d2/2 * ppd, cy+d2/2 * ppd], d2 * ppd);
Screen(w, 'Flip');
WaitSecs(2);
Screen('Close', w);

采纳的回答

Tim Lauer
Tim Lauer 2019-6-6

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Timing and presenting 2D and 3D stimuli 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by