This is actually the expected behavior, as "evalin" and "assignin" cannot be used recursively to reach more than one level deep in the function call stack.
For more information, see the 'Limitation' section of the "evalin" documentation page:
This change was made in MATLAB R2015b (so R2015a and earlier versions have the old behavior you observed in R2014b) to standardize the behavior of "evalin".
As a workaround for MATALB R2015b and more recent versions, you can change the line
>> evalin('base','assignin(''caller'',''varName'',varName)');
to
>> varName = evalin('base', 'varName');
which will create a new variable, 'varName', in your function workspace with the same value as 'varName' in the base workspace.
Best Answer