From: Chris on
Hi All,

I am working with PTB 3 trying to make a code script written in 2009 with PTB 2 run. There also seems to be some general errors in the script as well. Is there a file that I can look at to see what was changed for PTB 3 from version 2?
From: Bruce on
"Chris " <chris.a.gauthier(a)gmail.com> wrote in message <i12tn1$dvb$1(a)fred.mathworks.com>...
> Hi All,
>
> I am working with PTB 3 trying to make a code script written in 2009 with PTB 2 run. There also seems to be some general errors in the script as well. Is there a file that I can look at to see what was changed for PTB 3 from version 2?

Hello Chris,

Although I did not find a file of info. on the differences between the PTB3 and PTB2
I found this useful link:
http://psychtoolbox.org/wikka.php?wakka=FaqBackwardsCompatible

In particular, (from the weblink):
{if you must use old code written for PTB-2, you can switch PTB-3 into some kind of compatibility mode by adding the following command at the very top of your script:

% Enable compatibility mode to old PTB-2:
Screen('Preference', 'EmulateOldPTB', 1);
}

BTW: I presume you are using either MATLAB R2009a or R2009b with the PTB as you say 2009 in your spiel. But out of interest are you using an Intel-based Mac or a Intel PC running Windows when you use MATLAB and PTB?
If you are using an Intel-based Mac then this link may be of use too:
http://psychtoolbox.org/wikka.php?wakka=IntelMacCurrentState

As an aside I had some difficulty getting PTB2 working with MATLAB and Windows but managed to run and compile some demos in the end after some code-tweaking.

I hope the links help you out and I wish you the best of luck with the PTB too.

Regards,

Bruce
From: Chris on
Bruce,

Thank you SO much. This is very interesting and helpful. I will be making the program compatible with intel-based mac and intel-based PC windows. I am using R2009b Matlab.

I don't know if you know much about KbCheck, but I am trying to get two reaction time responses at the same time and am unsure about how to do that. PTB doesn't mention much about it. Would you happen to know how I could manage this or point me in a direction towards code that has done this before with PTB 3?

Thanks again.

Chris

"Bruce " <bremove.thisraineorama(a)gmail.com> wrote in message <i1li44$6or$1(a)fred.mathworks.com>...
> "Chris " <chris.a.gauthier(a)gmail.com> wrote in message <i12tn1$dvb$1(a)fred.mathworks.com>...
> > Hi All,
> >
> > I am working with PTB 3 trying to make a code script written in 2009 with PTB 2 run. There also seems to be some general errors in the script as well. Is there a file that I can look at to see what was changed for PTB 3 from version 2?
>
> Hello Chris,
>
> Although I did not find a file of info. on the differences between the PTB3 and PTB2
> I found this useful link:
> http://psychtoolbox.org/wikka.php?wakka=FaqBackwardsCompatible
>
> In particular, (from the weblink):
> {if you must use old code written for PTB-2, you can switch PTB-3 into some kind of compatibility mode by adding the following command at the very top of your script:
>
> % Enable compatibility mode to old PTB-2:
> Screen('Preference', 'EmulateOldPTB', 1);
> }
>
> BTW: I presume you are using either MATLAB R2009a or R2009b with the PTB as you say 2009 in your spiel. But out of interest are you using an Intel-based Mac or a Intel PC running Windows when you use MATLAB and PTB?
> If you are using an Intel-based Mac then this link may be of use too:
> http://psychtoolbox.org/wikka.php?wakka=IntelMacCurrentState
>
> As an aside I had some difficulty getting PTB2 working with MATLAB and Windows but managed to run and compile some demos in the end after some code-tweaking.
>
> I hope the links help you out and I wish you the best of luck with the PTB too.
>
> Regards,
>
> Bruce
From: Bruce on
"Chris " <chris.a.gauthier(a)gmail.com> wrote in message <i1oh96$8qf$1(a)fred.mathworks.com>...
> Bruce,
>
> Thank you SO much. This is very interesting and helpful. I will be making the program compatible with intel-based mac and intel-based PC windows. I am using R2009b Matlab.
>
> I don't know if you know much about KbCheck, but I am trying to get two reaction time responses at the same time and am unsure about how to do that. PTB doesn't mention much about it. Would you happen to know how I could manage this or point me in a direction towards code that has done this before with PTB 3?
>
> Thanks again.
>
> Chris
>
> "Bruce " <bremove.thisraineorama(a)gmail.com> wrote in message <i1li44$6or$1(a)fred.mathworks.com>...
> > "Chris " <chris.a.gauthier(a)gmail.com> wrote in message <i12tn1$dvb$1(a)fred.mathworks.com>...
> > > Hi All,
> > >
> > > I am working with PTB 3 trying to make a code script written in 2009 with PTB 2 run. There also seems to be some general errors in the script as well. Is there a file that I can look at to see what was changed for PTB 3 from version 2?
> >
> > Hello Chris,
> >
> > Although I did not find a file of info. on the differences between the PTB3 and PTB2
> > I found this useful link:
> > http://psychtoolbox.org/wikka.php?wakka=FaqBackwardsCompatible
> >
> > In particular, (from the weblink):
> > {if you must use old code written for PTB-2, you can switch PTB-3 into some kind of compatibility mode by adding the following command at the very top of your script:
> >
> > % Enable compatibility mode to old PTB-2:
> > Screen('Preference', 'EmulateOldPTB', 1);
> > }
> >
> > BTW: I presume you are using either MATLAB R2009a or R2009b with the PTB as you say 2009 in your spiel. But out of interest are you using an Intel-based Mac or a Intel PC running Windows when you use MATLAB and PTB?
> > If you are using an Intel-based Mac then this link may be of use too:
> > http://psychtoolbox.org/wikka.php?wakka=IntelMacCurrentState
> >
> > As an aside I had some difficulty getting PTB2 working with MATLAB and Windows but managed to run and compile some demos in the end after some code-tweaking.
> >
> > I hope the links help you out and I wish you the best of luck with the PTB too.
> >
> > Regards,
> >
> > Bruce

Hello Chris,

Apparently if you are looking for reaction time responses from a mouse click
KbCheck doesn't return mouse button state anymore (if using PTB-3.0.8 on MS-Windows).
http://tech.dir.groups.yahoo.com/group/psychtoolbox/message/6768

If it is only the keyboard you are using (unlikely as you mention 2 reaction times e.g. mouse and keyboard perhaps?) then no problem with PTB3. If your 2 reactions
are mouse and keyboard then this code won't work for PTB3 and only returns
the keyboard code.

Please try this if mouse and keyboard detection needed (from same weblink) but modified by me (it is untried so may require tweaking):

while programloop
[x y buttons]=GetMouse;
[keyIsDown, t1, keyCode]=KbCheck;

if buttons(1)
clickTime=GetSecs;
disp(clickTime)
end;
if find(keyCode==13) %enter button
disp(t1)
end;
end

Best of luck and I wish I could be more helpful.

Cheers
Bruce
From: Chris on
Thanks for all your help!

I have a slight problem with the keyboard timing in that it says sometimes that it is .003sec apart which is nearly impossible so I know that there is something wrong with my math or with the timing objects. Can anyone see where I made an error?

Thanks in advance!
Chris

% Green Circle on
x = 1;
rt1 = 0;
rt2 = 0;
startSecs = GetSecs;
eventgo = [eventgo startSecs];
tStart = tic; kStart = tic;
while GetSecs < startSecs + duration
greenCircle(window, readycolor, outline, gocolor, greencircle); %calls the green %circle function to display

%keyboard check for 2 inputs, rt1 and rt2
while x
[ keyIsDown, t1, keyCode ] = KbCheck;
%Player 1
if keyIsDown
key1 = toc(tStart);
w = find(keyCode);
if keyCode(targetKey2) || keyCode(targetScan2)
%rt1 = t1 - startSecs;
rt2 = key1;
elseif keyCode(targetKey1) || keyCode(targetScan1)
%rt2 = t1 - startSecs;
rt1 = key1;
elseif w ~= keyCode(targetKey1) && w ~= keyCode(targetKey2)&& w~=keyCode(escapeKey)
wrong(eventWrong, t2, window, target1, target2, frontcolor, readycolor, outline, gocolor, greencircle);
end
if w == keyCode(escapeKey)
exit = 1;
break;
end
FlushEvents(['keyDown']);
end

%Player 2
[ keyIsDown, t2, keyCode ] = KbCheck;

if keyIsDown
key2= toc(kStart);
w = find(keyCode);
if keyCode(targetKey2) || keyCode(targetScan2)
%rt2 = t2 - startSecs;
rt2 = key2;
elseif keyCode(targetKey1) || keyCode(targetScan1)
%rt1 = t2 - startSecs;
rt1 = key2;
elseif w ~= keyCode(targetKey1) && w ~= keyCode(targetKey2)&& w~=keyCode(escapeKey)
wrong(eventWrong, t2, window, target1, target2, frontcolor, readycolor, outline, gocolor, greencircle);
end
if w == keyCode(escapeKey)
exit = 1;
break;
end
FlushEvents(['keyDown']);
end

%after two button presses, the program moves on.
if rt1 ~= 0 && rt2 ~=0
x= 0;
end
%green circle


end
if rt1 ~= 0 && rt2 ~=0
break;
end
end