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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -