# Help with Multitouch

**URL:** <https://psychtoolbox.discourse.group/t/help-with-multitouch/4953>\
**Category:** Programming Help\
**Tags:** windows\
**Created:** [April 22, 2023, 1:33pm UTC](https://psychtoolbox.discourse.group/t/help-with-multitouch/4953 "2023-04-22T13:33:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecast](https://avatars.discourse-cdn.com/v4/letter/e/3bc359/32.png) [@ecast](https://psychtoolbox.discourse.group/u/ecast)\
**Post date:** [April 22, 2023, 1:33pm UTC](https://psychtoolbox.discourse.group/t/help-with-multitouch/4953/1 "2023-04-22T13:33:28Z")

</div>

Dear experts,  
I am using Matlab R2023a with PsychtoolboxVersion 3.0.19 - Flavor: beta - Corresponds to SVN Revision 13508 installed on a Surface Pro 6 Commercial Model 1796 i5 with Windows Windows 10 Pro.  
I am not new to psychtoolbox, but I am new to record responses from touchscreens. I have searched for previous similar questions and tried to solve my problem by running the demos, but I am still not quite there. I would be very greatfull if you could help me.  
I would like to create a sort of line bisection task, so I would like to display a line onscreen for unlimited time untill the patient touch it in the middle. However rather than just ask the patients to simply point (and touch the middle of the line) with one finger, I would like them to “grasp” the line, so by using two fingers, as if they are grasping a pen and measure the x and y of each of the two fingers (so that afterward I can measure the aperture of the fingers).  
Below is part of the code that have the following two problems:

1. the line is diplayed onscreen, but then the screen is refreshed , so it turns black and then the line is disaplyes again. How can I avoid the screen from flashing black?

2. I would like the for loop across trials (different line lengths) to go on to the next trial soon after the patient has touched the screen (with the two fingers as described above), but at the moment it is going on only after keyboard press.  
I copy part of the code below.  
Resp=;  
for t=1:length(pix\_linelength)  
% play sound  
[soundData freq] = audioread(‘ding.wav’);  
PsychPortAudio(‘FillBuffer’, pahandle, soundData’);  
PsychPortAudio(‘Start’, pahandle, 1,0);  
WaitSecs(1)

end

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [April 27, 2023, 8:25pm UTC](https://psychtoolbox.discourse.group/t/help-with-multitouch/4953/2 "2023-04-27T20:25:16Z")

</div>

Your approach is way insufficient to make this work in any robust way and clearly nobody feels like helping you for free.

I toyed around a bit with this idea you want to implement, and produced some sample script that you could use as a starting point for your experiment. This has taken myself a bit more than 1.5 hours, including testing on Ubuntu Linux 20.04.6-LTS and Windows 11 21H2 on my MS Surface Pro 6.

So if you want this help and sample code, quickly post your paid support authentication token to pay for the first 30 minutes out of 90 minutes (`help PsychPaidSupportAndServices`). You’d then have to buy another extra hour of support on top of that, following my instructions, but how much the extra hour costs depends on how old your current PTB membership license is - the one you hopefully own to get a good discount, otherwise you’d look at something like 500 Euros + sales tax.

-mario

---

<div class="post-metadata">

**Author:** ![ecast](https://avatars.discourse-cdn.com/v4/letter/e/3bc359/32.png) [@ecast](https://psychtoolbox.discourse.group/u/ecast)\
**Post date:** [April 28, 2023, 6:18am UTC](https://psychtoolbox.discourse.group/t/help-with-multitouch/4953/3 "2023-04-28T06:18:56Z")

</div>

No, thank you, I don’t have money to spend on this.  
If I can sort it out myself, I will post the solution for free, in case other researchers find it useful.

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [April 28, 2023, 4:08pm UTC](https://psychtoolbox.discourse.group/t/help-with-multitouch/4953/4 "2023-04-28T16:08:27Z")

</div>

Ok, fair enough. Obviously the problem is solvable, as I solved it already, but judging the current state of your code you’ll have a good amount of learning and work ahead of you.

Good luck,  
-mario
