gevfit error: Operands to the || and && operators must be convertible to logical scalar values

9 views (last 30 days)
Hello,
Using Matlab R2018b, I just run an example GEV Distribution
blocksize = 1000;
nblocks = 250;
rng default % For reproducibility
t = trnd(5,blocksize,nblocks);
x = max(t);
% 250 column maxima
paramEsts = gevfit(x)
I got the error message:
Operands to the || and && operators must be convertible to logical scalar values.
Error in gevfit (line 74)
if n == 0 || ~isfinite(rangex)
Error in huy_test_stats (line 9)
paramEsts = gevfit(x);
Does it a bug? or how could it be solved?
Thanks
  1 Comment
Roby Pad
Roby Pad on 16 Feb 2024
Moved: the cyclist on 16 Feb 2024
Hello, I have the very same problem which started all of a sudden a couple of days ago. I have Matlab2023b version, and I have just tried unistalling and reinstalling again, but it doesn't work.
Can someone help me?
Roby

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 2 Jan 2019
That code works for me, in both 2018b and 2019a.
Does this happen with a freshly started instance of MATLAB?
If so, you might want to use the which command to check whether you are calling the functions from the places you expect. Another common error is to name a variable the same as a function.
  4 Comments
Colin
Colin on 14 Apr 2024 at 19:09
Very old thread here, but I just had the same problem and this appears to be the only thread directly addressing it. What worked for me (using R2023a) was to go into the toolbox/stats/stats/gevfit.m function and change line 73 from
rangex=range(x);
to
rangex = xmax-xmin;
Something seems buggy with the range function, in other words, at least in this setting.

Sign in to comment.

More Answers (0)

Categories

Find more on Historical Contests in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!