trouble with the function 'Screen' running code with psychtoolbox
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Juliane Zimmermann
am 21 Mai 2019
Kommentiert: Juliane Zimmermann
am 8 Jun. 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);
0 Kommentare
Akzeptierte Antwort
Tim Lauer
am 6 Jun. 2019
I think you should adjust width/dist as suggested here: https://www.mathworks.com/matlabcentral/answers/318433-can-someone-please-help-me-in-correcting-these-program-this-is-a-file-to-draw-combination-of-dot-c.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Timing and presenting 2D and 3D stimuli finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!