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

9 次查看(过去 30 天)
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 个评论
Roby Pad
Roby Pad 2024-2-16
移动:the cyclist 2024-2-16
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

请先登录,再进行评论。

采纳的回答

the cyclist
the cyclist 2019-1-2
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 个评论
Colin
Colin 2024-4-14,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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Historical Contests 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by