www.gusucode.com > external 工具箱matlab源码程序 > external/engines/engine_api/+matlab/+internal/+engine/getVariable.m

    function ret=getVariable(varname)
%    FOR INTERNAL USE ONLY -- This function is intentionally undocumented
%    and is intended for use only with the scope of function in the MATLAB 
%    Engine APIs.  Its behavior may change, or the function itself may be 
%    removed in a future release.

% Copyright 2016 The MathWorks, Inc.

% GETVARIABLE returns a MATLAB variable from the base workspace.
    flag = evalin('base', ['exist(''' varname ''',''var'')']);
    if flag
	ret = evalin('base', varname);
    else
	error(['Undefined variable ''' varname '''.']);
    end
end