Skip to content

Commit

Permalink
change default workspace to caller for jload and jsave
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Jun 12, 2020
1 parent ff8ae00 commit c334799
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions jload.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
% to a field in opt. opt can have the following
% fields (first in [.|.] is the default)
%
% ws ['base'|'wsname']: the name of the workspace in which the
% ws ['caller'|'base']: the name of the workspace in which the
% variables are to be saved
% vars [{'var1','var2',...}]: list of variables to be saved
% header [0|1]: if set to 1, return the metadata of the variables
Expand All @@ -36,7 +36,7 @@
% varlist: a list of variables loaded
%
% examples:
% jload % load all variables in jamdata.jamm to the 'base' workspace
% jload % load all variables in jamdata.jamm to the 'caller' workspace
% jload mydat.jamm
% jload('mydat.jamm','vars', {'v1','v2',...}) % load selected variables
% jload('mydat.jamm','simplifycell',1)
Expand All @@ -53,7 +53,7 @@

opt=varargin2struct(varargin{:});

ws=jsonopt('ws','base',opt);
ws=jsonopt('ws','caller',opt);

loadfun=@loadbj;
if(regexp(filename,'\.[jJ][sS][oO][nN]$'))
Expand Down
6 changes: 3 additions & 3 deletions jsave.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
% to a field in opt. opt can have the following
% fields (first in [.|.] is the default)
%
% ws ['base'|'wsname']: the name of the workspace in which the
% ws ['caller'|'base']: the name of the workspace in which the
% variables are to be saved
% vars [{'var1','var2',...}]: cell array of variable names to be saved
% matlab [0|1] if set to 1, use matlab's built-in jsonencode to
Expand All @@ -34,7 +34,7 @@
% varlist: a list of variables loaded
%
% examples:
% jsave % save all variables in the 'base' workspace to jamdata.jamm
% jsave % save all variables in the 'caller' workspace to jamdata.jamm
% jsave('mydat.jamm','vars', {'v1','v2',...}) % save selected variables
% jsave('mydat.jamm','compression','lzma')
%
Expand All @@ -50,7 +50,7 @@

opt=varargin2struct(varargin{:});

ws=jsonopt('ws','base',opt);
ws=jsonopt('ws','caller',opt);

allvar=evalin(ws,'whos');
varlist=jsonopt('vars',{allvar.name},opt);
Expand Down

0 comments on commit c334799

Please sign in to comment.