Output argument "a" (and maybe others) not assigned during call to

2 views (last 30 days)
I get this error message when running the code, 'Output argument "a" (and maybe others) not assigned during call to...MH'. But 'a' is exactly in the output from function MH, plus, if I run the codes for each j, it works fine, only when I run the loop, this error message comes out. Where do I get wrong?
for i=2:N
x = xdraw(i-1, :);
for j = 1:5
new = normrnd(x(j), sigma(j));
[x a] = MH(x,j,new,y,sigma);
acc_x(j)=acc_x(j)+a;
end
xdraw(i, :) = x;
end

Accepted Answer

Image Analyst
Image Analyst on 29 Mar 2015
You gave the calling routine, but for some reason you forgot to give MH, which is the most crucial code we need to see. Most likely you didn't initialize "a" and only assigned it inside a block of code that is not getting run, for example inside an "if" block.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!