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

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;

답변 (1개)

Star Strider
Star Strider 2015년 7월 21일
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

When I did that, a comment came up beside and said " Has no license available"
You need to contact either your MATLAB license administrator to get the Statistics Toolbox, or MathWorks Support, depending on your situation.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Installation and Operational Settings에 대해 자세히 알아보기

질문:

2015년 7월 21일

댓글:

2015년 7월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by