Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Psychtoolbox error "undefined function"

186 views
Skip to first unread message

Trevor Dubois

unread,
Feb 27, 2015, 7:48:34 PM2/27/15
to
Hi all,

I am learning to use Matlab and have stumbled upon a problem that I cannot find information about online.

I installed the extension Psychtoolbox and I tried to run a program using this tool box but there is an error that seems to relate to it.

Error:

Undefined function 'SetupToolBox' for input arguments of type 'double'.
Error in ImageryExp1 (line 10)
[w, ScreenRect,Width,Height] = SetupToolBox(1/2,0,128);

Script:

clc;
clear all;
close all;
ListenChar(2);
TxtSize=35;
[w, ScreenRect,Width,Height] = SetupToolBox(1/2,0,128);
%the colour will be grey and this command starts up PTB
%monitor will be on default screen mode shown by the 0
%the screen size will be either full of part of the full screen size
%determined by the 1/2 numbers

Screen('TextFont',w, 'Times New Roman'); %Chooses Times New Roman Font
Screen('TextStyle', w, 2); %Chooses bold text which is represented by 3
Screen('TextSize',w, TxtSize);

%Collect demographic data from participants using psychtoolbox
S_data{1} = GetEchoString(w, 'Please write down your name.', 10,0, [255 0 0], [128 128 128]);
S_data{2} = str2num(GetEchoString(w, 'Please write down your age.', 10, 2*TxtSize, [255 0 0], [128 128 128]));
S_data{3} = GetEchoString(w, 'Please write down whether your gender is M/F.', 10, 3*TxtSize, [255 0 0], [128 128 128]);
S_data{4} = str2num(GetEchoString(w, 'Please write down your participant number', 10, 5*TxtSize, [255 0 0], [128 128 128]));


%information telling participant to continue
DrawFormattedText(w, 'Please press the spacebar in order to continue on to the next page', 'center', round(Height*0.9), [0 0 225]);
Screen('The information will not be flipped', w); % the information will now be displayed on the screen

[KeyIsDown, ~, KeyCode] = KbCheck; %this does a KbCheck to make sure no keys etc are pressed down

while -strcmp(KbName(KeyCode), 'space') %Force spacebar press
[KeyIsDown, ~, KeyCode] = KbCheck;
end

KbReleaseWait; %waits until all keys are released
WaitSecs(1);
------------------------------------------

It seems to me that I did not properly install Psychtoolbox but I have spent several hours reading, rereading and installing then reinstalling many aspects of this software and I cannot seem to find a solution of how to make it work.

Thus a starting step is can I check whether it is installed correctly with a command? And secondly if it is not what can I do to fix this?

All the best,

Trevor

dpb

unread,
Mar 1, 2015, 10:10:06 AM3/1/15
to
On 02/27/2015 6:48 PM, Trevor Dubois wrote:
...

> I installed the extension Psychtoolbox and I tried to run a program
> using this tool box but there is an error that seems to relate to it.
...

> It seems to me that I did not properly install Psychtoolbox but I have
> spent several hours reading, rereading and installing then reinstalling
> many aspects of this software and I cannot seem to find a solution of
> how to make it work.
...

TMW supports installation/startup issues; contact TMW support at
<www.mathworks.com> directly for such...

--

Trevor Dubois

unread,
Mar 1, 2015, 10:47:36 AM3/1/15
to
"Trevor Dubois" wrote in message <mcr38q$ke3$1...@newscl01ah.mathworks.com>...
-----------------------------------------------------

To update my post I finally found the problem at the end and so I thought I'd post it in case anyone else had a similar problem. The issue was that even though Psychtoolbox was installed it was necessary to put a SetupToolBox.m file into the same folder or directory as the Matlab code that you opened up without which the code would not work. My understanding is that this is the function which needs to be available for Matlab to access and so without the function being in the same directory Matlab cannot access it.

I hope this helps anyone with a similar difficulty and although I understand that this might be a basic issue for some people, for others that are new to Matlab and programming, they might benefit from this meaning that even though it might seem like a trivial and unimportant point it might not be for those new to Matlab.

Trevor

Steven Lord

unread,
Mar 2, 2015, 9:47:01 AM3/2/15
to


"dpb" <no...@non.net> wrote in message news:mcva2j$27d$1...@dont-email.me...
Except in this case Psychtoolbox is not a MathWorks product, so MathWorks
support probably can't offer guidance. This is the right place to look for
support for Psychophysics Toolbox:

http://psychtoolbox.org/

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Steven Lord

unread,
Mar 2, 2015, 9:48:57 AM3/2/15
to


"Trevor Dubois" <trevor....@gmail.com> wrote in message
news:mcvcaj$1mu$1...@newscl01ah.mathworks.com...
> "Trevor Dubois" wrote in message
> <mcr38q$ke3$1...@newscl01ah.mathworks.com>...

*snip*

> To update my post I finally found the problem at the end and so I thought
> I'd post it in case anyone else had a similar problem. The issue was that
> even though Psychtoolbox was installed it was necessary to put a
> SetupToolBox.m file into the same folder or directory as the Matlab code
> that you opened up without which the code would not work. My understanding
> is that this is the function which needs to be available for Matlab to
> access and so without the function being in the same directory Matlab
> cannot access it.

The "Installation without Download" section of the Psychtoolbox website
mentions SetupPsychToolbox, but suggests it's a function that that toolbox
should provide. If it doesn't you probably should contact the
authors/maintainers and ask if the instructions need to be fixed/updated.

http://psychtoolbox.org/download/

John Allen

unread,
Apr 26, 2017, 4:48:08 AM4/26/17
to
"Trevor Dubois" wrote in message <mcr38q$ke3$1...@newscl01ah.mathworks.com>...
> Hi all,
...
>
> Thus a starting step is can I check whether it is installed correctly with a command? And secondly if it is not what can I do to fix this?
>
.. to answer the first part of your question, what I do to test whether PsychToolbox has installed properly is to run
GratingDemo
as a command in the Matlab command window - if it runs ok (you'll get a stripy grey and black image in the centre of the screen) then it's usually installed ok. If not, then you'll need to read the error messages to find out what's wrong.

John
0 new messages