from
vars2base
by Chris Cannell
Copy current workspace variables to the base workspace
|
| vars2base.m |
%VARS2BASE Copy current workspace variables to the base workspace
% VARS2BASE copies all variables in the current workspace to the base
% workspace. VARS2BASE is useful if you want variables from inside a
% function to be accessible from the base workspace.
%
% Usage: vars2base
%
%
% See also who, whos, assignin, clear, computer, dir, evalin, exist,
% inmem, load, save, what, workspace.
%
% Reference page in Help browser
% <a href="matlab:doc vars2base">doc vars2base</a>
% Written by Chris J Cannell
% Contact ccannell@gmail.com for questions or comments.
% 06/26/2006
% get list of variable names in the current workspace
varNames = who;
% loop through all variables in the current workspace
for varNamesii = 1:length(varNames)
% convert variable name from cell to string
varName = char(varNames(varNamesii));
% assign variable to the base workspace
assignin('base', varName, eval(varName));
end
|
|
Contact us at files@mathworks.com