# How to present two streams of images on one screen simultaneously?

**URL:** <https://psychtoolbox.discourse.group/t/how-to-present-two-streams-of-images-on-one-screen-simultaneously/3151>\
**Category:** Programming Help\
**Created:** [March 27, 2020, 4:22pm UTC](https://psychtoolbox.discourse.group/t/how-to-present-two-streams-of-images-on-one-screen-simultaneously/3151 "2020-03-27T16:22:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yu\_Takahashi](https://avatars.discourse-cdn.com/v4/letter/y/ecae2f/32.png) [@Yu\_Takahashi](https://psychtoolbox.discourse.group/u/Yu_Takahashi)\
**Post date:** [March 27, 2020, 4:22pm UTC](https://psychtoolbox.discourse.group/t/how-to-present-two-streams-of-images-on-one-screen-simultaneously/3151/1 "2020-03-27T16:22:14Z")

</div>

Dear community members

I am a vision researcher, currently using psychtoolbox3 to program my experiment, the plan is to **present two streams of alternating images and textures with different frequencies simultaneously on one monitor**.

To be more precise, **I want the two scripts to start at the same time.** I have tried parallel computing toolbox, but with little success, just wondering whether there is an easier way to program for what I intended.

e.g. ,

Right side: TextureA -\> imageB -\> TextureA -\> imageB…

```auto
nPresentations = 10.  
       for presentationcount = 1:nPresentations %10 rounds
            Screen('FillRect', windowPtr,[0 0 255], destinationRect_L ) % present TextureA for 1 sec
            Screen('Flip', windowPtr);
            WaitSecs(1);
            
            image = imread('imageB.jpg'); % present imageB for 0.5 second 
            texture = Screen('Maketexture', windowPtr, image);
            Screen('DrawTexture', windowPtr, texture, [], destinationRect_R);
            Screen('Flip', windowPtr);
            WaitSecs(0.4);
       end
       

```

Left side: imageC -\> imageD -\> imageC -\> imageD…

```auto
nPresentations = 20
       for presentationcount = 1:nPresentations %20 rounds
            image = imread('imageC.jpg'); % present imageC for 0.7 second 
            texture = Screen('Maketexture', windowPtr, image);
            Screen('DrawTexture', windowPtr, texture, [], destinationRect_L); 
            Screen('Flip', windowPtr);
            WaitSecs(0.7);
            
            image = imread('imageD.jpg'); % present imageD for 0.3 second 
            texture = Screen('Maketexture', windowPtr, image);
            Screen('DrawTexture', windowPtr, texture, [], destinationRect_L);
            Screen('Flip', windowPtr);
            WaitSecs(0.3);
       end

```

p.s. I also posted this question on mathworks, one member kindly suggested using timer callback functions, but they use a very different sets of functions, that I am having a pretty difficult time with. I was thus wondering whether there is other work around for programming rivalry experiments?

thanks in advance

Yu
