trouble with the function 'Screen' running code with psychtoolbox

4 vues (au cours des 30 derniers jours)
Juliane Zimmermann
Juliane Zimmermann le 21 Mai 2019
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);

Réponse acceptée

Tim Lauer
Tim Lauer le 6 Juin 2019
  1 commentaire
Juliane Zimmermann
Juliane Zimmermann le 8 Juin 2019
Thank you, Tim, for your answer!
I adjusted width and dist, and now it works.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Timing and presenting 2D and 3D stimuli dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by