Undefined function 'exprnd' for input arguments of type 'double'

12 views (last 30 days)
I am trying to call this function from a script but when I run it I get the error: Undefined function 'exprnd' for input arguments of type 'double' I am using psychtoolbox and stat toolbox.
function y = expsample(mean_t,min_t,max_t,interval)
% produce a random sample from an exponential distribution (with
% given mean) within limits (min/max) given a mean. round to nearest interval
% this is useful for generating jittered time intervals between
% stim presentations for event-related designs
tmp=exprnd(mean_t);
tmp=tmp-mod(tmp,interval); % round to nearest interval
while (tmp < min_t | tmp > max_t),
tmp=exprnd(mean_t);
tmp=tmp-mod(tmp,interval); % round to nearest interval
end;
y=tmp;

Answers (1)

Star Strider
Star Strider on 21 Jul 2015
If you have successfully used the Statistics Toolbox before this, you need to be certain that the exprnd function still exists on your MATLAB path, and that it is not being ‘shadowed’ (or ‘overshadowed’) by another function.
Type this in your script or the Command Window:
which exprnd -all
On my Windows machine, I get only one result:
C:\Program Files\MATLAB\R2015a\toolbox\stats\stats\exprnd.m
If you get more than one result, you need to rename the function that is not in the Statistics Toolbox. Otherwise, you may need to reset the toolbox cache. Type these in your script or the Command Window:
restoredefaultpath
rehash toolboxcache
If none of these work, contact MathWorks Support.
  2 Comments
Britta Hahn
Britta Hahn on 21 Jul 2015
When I did that, a comment came up beside and said " Has no license available"
Star Strider
Star Strider on 21 Jul 2015
You need to contact either your MATLAB license administrator to get the Statistics Toolbox, or MathWorks Support, depending on your situation.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!