matlab - Draw shaps of squares using PTB -
i want draw 4 squares, side side, using ptb experiment, code not work.. here code,
square_size = [0 0 50 50]; squarexpos = [screenxpixels * 0.125 screenxpixels * 0.25 screenxpixels * 0.5 screenxpixels * 0.75]; numsqaures = length(squarexpos); allcolors = [1 0 0; 0 1 0; 0 0 1; 1 0 0]; allrects = nan(4, 4); = 1:numsqaures allrects(:, i) = centerrectonpointd(square_size, squarexpos(i), ycenter); end screen('fillrect', window, allcolors, allrects); screen('flip', window); kbstrokewait;
if knows how can fix problem, please me.
it's hard without seeing error.
if had guess, there's wrong format of inputs.
here's potential problems noticed @ first glance.
psychtoolbox (unlike matlab) uses rgb scale 0 - 255 instead of 0 - 1. code colors show black. instead of [1,0,0] red, use [255,0,0].
your allcolors matrix nitems x 3(rgb), function wants opposite way. instead of entering allcolors, need transpose: allcolors'.
if i'm struggling pscyhtoolbox, first thing check formatting of inputs. appropriate format inputs, type:
screen('fillrect?')
Comments
Post a Comment