0

I run the following code as I am trying to display numbers at randoma locations on the screen:

% Screen parameters
center = [screenRect(3)/2 screenRect(4)/2)];
[mainwin, screenRect] = Screen(0, 'OpenWindow');

% potential locations to place sequences
nrow = 6; ncolumn = 6; cellsize = 100;
for ncells = 1:nrow*ncolumn
    xnum = (mod(ncells-1, ncolumn)+1)-3.5;
    ynum = ceil(ncells/nrow)-3.5;
    cellcenter(ncells,1) = center(1)+xnum.*cellsize;
    cellcenter(ncells,2) = center(2)+ynum.*cellsize;
end

% randomise position of numbers
cellindex = Shuffle(1:nrow*ncolumn); % randomize the position of the sequences within the grid specified earlier
     itemloc = [cellcenter(cellindex(1),1)-cellsize/2, cellcenter(cellindex(1),2)-cellsize/2, cellcenter(cellindex(1),1)+cellsiz

I get the following error:

Unrecognized function or variable 'screenRect'.

Error in First_draft (line 4)
center = [screenRect(3)/2 screenRect(4)/2];
hellothere
  • 35
  • 5

1 Answers1

0

If you are sure that you installed the toolbox correctly, Then

    1. return the screenRect variable, using Screen method.
    • [mainwin, screenRect] = Screen(0, 'OpenWindow');
      
    1. Then use screenRectvariable
    • center = [screenRect(3)/2 screenRect(4)/2];
      

  ```

Ahmet
  • 7,527
  • 3
  • 23
  • 47
  • It doesn't seem to recognise the 'screenRect' variable. I skipped the install Subversion step of the toolbox installation process. Would this explain the issue? Otherwise, I downloaded the link and inserted 'DownloadToolbox' into the command window which seemed to work. – hellothere Aug 15 '20 at 15:26