matlab - How to overshadow build-in function with dynamic variables -
when dynamically creating variables assignin in matlab, not work when variable name conflicts existing function name. here example:
function test( ) f() beta beta end function f() assignin('caller','beta',1) assignin('caller','beta',1) end evaluating beta fails, since not recognized variable.
>> test beta = 1 not enough input arguments. error in beta (line 19) y = exp(betaln(z,w)); error in test (line 5) beta apparently because initial jit compilation recognizes function calls , not over-shadow existing functions (in case beta function statistics toolbox) dynamically created variables.
my question whether there way force overshadowing functions using assignin, making above example code work.
ps: 1 way initialize variable name adding beta=[]; on first line of test(). problem in application interested in, don't know variable names ex ante.
Comments
Post a Comment