Why my wblfit function gives errors

For my x dataset of 300 values (0<x<5), the command wblfit(x) gives the following error. I am running version R2009a. I do not have to meddle with evfit built in function, do I?
??? Operands to the || and && operators must be convertible to logical scalar values.
Error in ==> evfit at 94
if n == 0 || nuncensored == 0 || ~isfinite(rangex)
Error in ==> wblfit at 74
parmhatEV = evfit(log(x),alpha,censoring,freq,options);

2 个评论

What shape is your x? Looking at the error, I would speculate that you are passing in an array but that the code expects a vector.
My x is an array >> size(x)
ans =
224 1

请先登录,再进行评论。

回答(1 个)

Peter Perkins
Peter Perkins 2012-9-19
Russ, your data input x is a vector, and in any case the code checks for a vector. But you haven't said what any of your other inputs are. It's pretty much impossible to figure this out second hand. I recommend that you open evfit in the editor, set a break point on line 94, and when execution stops on that line, hover over the three variables n, nuncensored, and rangex, and see which of them is not a scalar. Then look at the variables that are used on the RHS of lines 86-90 and see if you can figure out why.
Given that evfit checks that x is a vector, and checks that cens and freq are the same size as x, my best guess is that you have unintentionally shadowed some function. But of course there may be something subtle that I'm not seeing.
Hope this helps.

标签

Community Treasure Hunt

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

Start Hunting!

Translated by