MATLAB: Can anyone explain how can this happen

assigninMATLABnamespaceworkspace

function myfunctest
subfcn_set('notafunc');
whos
which notafunc
notafunc
subfcn_set('sin');
whos
which sin
sin
end
function subfcn_set(n)
assignin('caller', n, ['I am ',n]);
end
running myfunctest in matlab gives
>> myfunctest
Name Size Bytes Class Attributes
notafunc 1x13 26 char
notafunc is a variable.
notafunc =
I am notafunc
Name Size Bytes Class Attributes
notafunc 1x13 26 char
sin 1x8 16 char
sin is a variable.
Error using sin
Not enough input arguments.
Error in myfunctest (line 13)
sin
The builtin sin function is called even when a local variable "sin" exists.

Best Answer

I found the doc.
Another potential source of name conflicts occurs when you define a function that calls load or eval (or similar functions) to add variables to the workspace. In some cases, load or eval add variables that have the same names as functions. Unless these variables are in the function workspace before the call to load or eval, the MATLAB parser interprets the variable names as function names.