matlab - How can I define a unknown value in a function? -
i have m.file as,
for ii=1:40 m=round(x(ii,:)); % x matrix (40*1) . . end
also, have function as,
function cost=my_fun(x) iw_num=m*7;lw_num=1*m;b1_num=m*1;b2_num=1*1; . . end
because value of m in function not known, error. how can define value of m in function each value of m "for..end" loop defined in function??
try declaring variable m global
http://www.mathworks.in/help/matlab/ref/global.html
or
you can pass value of m function parameter
Comments
Post a Comment