0

我将如何一一显示 3x3 矩阵中的点,例如下面的代码?我想让 dot1 在网格的位置 [x1,y1] 出现时间 t1,然后 dot2 在网格的位置 [x2,y2] 出现时间 t2。每次只显示一个点。

感谢帮助

%grid
dim = 1
[x, y] = meshgrid(-dim:1:dim, -dim:1:dim);
pixelScale = screenYpixels / (dim * 2 + 2);
x = x .* pixelScale;
y = y .* pixelScale;
% Calculate the number of dots
numDots = numel(x);
% Make the matrix of positions for the dots.
dotPositionMatrix = [reshape(x, 1, numDots); reshape(y, 1, numDots)];
% We can define a center for the dot coordinates to be relaitive to. 
dotCenter = [xCenter yCenter];
dotColors = [1 0 0];
dotSizes = 20;
Screen('DrawDots', window, dotPositionMatrix,...
dotSizes, dotColors, dotCenter, 2);
4

1 回答 1

0

我想你想要这样的东西?

%positions of each successive dots:
x_vec = [1,2,3,1,2,3,1,2,3];
y_vec = [1,1,1,2,2,2,3,3,3];

%wait times in sec for each dot:
wait_times = [1,1,2,1,1,2,1,1,2]

dotColor = [1 0 0];
dotSize = 400;

num_dots = length(x_vec);
for i = 1:num_dots

    scatter(x_vec(i),y_vec(i),dotSize,dotColor,'filled');
    xlim([0,max(x_vec)])
    ylim([0,max(y_vec)])
    pause(wait_times(i));

end
于 2015-07-30T14:23:54.437 回答