0

I have a drawn a random dot matrix on the screen using matlab/psychtoolbox like this:

Screen('DrawDots', wPtr, dotPositionMatrix, dotSizes, dotColors, dotCenter, 2);
Screen('Flip', wPtr, (stimVbl + STIMULUS_DURATION - .5 * ifi), 0); 

Now I want to save the result somehow into a figure that I can print off. How do I do that? I have no idea where to start looking for this information i.e. to save what came up once on the screen. Any guidance much appreciated.

mehmet
  • 1,631
  • 16
  • 21

1 Answers1

1

Try Screen('GetImage'). In your case, for example:

Screen('DrawDots', wPtr, dotPositionMatrix, dotSizes, dotColors, dotCenter, 2);
Screen('Flip', wPtr, (stimVbl + STIMULUS_DURATION - .5 * ifi), 0); 
current_display = Screen('GetImage',wPtr);

The variable current_display will then be a 3D array of pixel values representing the screen at that moment. You can save this, export this, do whatever you want with it.

KerrBer
  • 129
  • 11
  • This is a great, straight-forward answer. Cheers. For anyone who wants to save as an image file simply add `imwrite(current_display, 'FileName.png');` – Docconcoct Jul 08 '21 at 03:23