trouble with the function 'Screen' running code with psychtoolbox

4 ビュー (過去 30 日間)
Juliane Zimmermann
Juliane Zimmermann 2019 年 5 月 21 日
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 日
  1 件のコメント
Juliane Zimmermann
Juliane Zimmermann 2019 年 6 月 8 日
Thank you, Tim, for your answer!
I adjusted width and dist, and now it works.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTiming 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