I have written this below function :
function [winner_index] = Auction(match_fit,match_index,cbid)bidmax = 0;m = match_fit;w = match_index;for i = 1:length(m) bid(i) = cbid*m(i,:); effectiveBid (i)= bid(i)+randn; if effectiveBid(i) > bidmax winner_index = w(i); bidmax = effectiveBid(i); endendend
Previously when I run this some times it is ok, sometime it was giving the below error " Output argument "winner_index" (and maybe others) not assigned during call to "Auction".
and now I am calling this function inside a loop. It is continuously showing the same error. I don't know why 🙁
[SL: edited to apply code formatting. Brinta, in the future please use the {}Code button to format your code.]
Best Answer