Can't assign output from a function from a toolbox

1 view (last 30 days)
I am having problem when I try to store rmabackadj function's output to a variable. The function works properly when no output variable is assigned. rmabackadj is a function from bioinformatics toolbox.
So the issue is when I try to run the following it works properly:
rmabackadj(myprobeData.PMIntensities)
But when I try to run the following I get an error:
>> A = rmabackadj(myprobeData.PMIntensities)
Warning: Colon operands must be real scalars.
> In rmabackadj>findMaxDensity at 255
In rmabackadj at 164
Error using ksdensity>parse_args (line 162)
X must be a non-empty vector.
Error in ksdensity (line 114)
[axarg,yData,n,ymin,ymax,xispecified,xi,u,m,kernelname,...
Error in rmabackadj>findMaxDensity (line 255)
[f, x] = ksdensity(z, min(z):(max(z)-min(z))/npoints:max(z), 'kernel', 'epanechnikov');
Error in rmabackadj (line 164)
mu = findMaxDensity( o(o < mu));
Someone else asked this question a while ago but there is no comment: http://www.mathworks.com/matlabcentral/answers/50323-affyrma-error-with-mfilename
I searched for it online as well, but I couldn't find any result. Does anybody have any idea about the cause of this error?
PS: When I assign ans variable to a new variable, it is properly assigned.
A = ans
  5 Comments
Hassan F
Hassan F on 23 Sep 2013
Update:
I checked rmabackadj function and found that the function doesn't handle the estimation of mu properly.
% estimate initial guess for mu
mu = findMaxDensity(o);
% estimate mu from left-of-the-mode data
mu = findMaxDensity( o(o < mu));
First estimate, gives a value for mu, but as Walter suggested, there is no o<mu and the second findMaxDensity function above, returns an empty mu value which overwrites the previous one.
dpb
dpb on 23 Sep 2013
Sounds like time to report your findings to official TMW support at mathworks.com -- maybe they can advise you on a workaround given that you've apparently debugged the cause if you can't see a suitable patch knowing the problem and (I presume) the correct response that should be returned.

Sign in to comment.

Accepted Answer

Hassan F
Hassan F on 3 Oct 2013
Mathworks confirmed this bug and issued a work around for it.
One possible workaround is to add the following conditional at line 163 of rmabackadj function
% estimate mu from left-of-the-mode data
if any(o < mu)
mu = findMaxDensity( o(o < mu));
end
The bug for N<1000 samples has been confirmed as well but no work around has been issued yet.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!