Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fangq/jsonlab
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Jun 6, 2022
2 parents fa35843 + 8b74d30 commit bed2366
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion savejd.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
error('you must provide file name');
end

opt=struct;

if(nargin>2)
if(nargin==3 && ischar(varargin{3}))
filename=varargin{3};
Expand All @@ -74,7 +76,14 @@
if(~exist('saveh5','file'))
error('you must first install EasyH5 from https://github.com/NeuroJSON/easyh5/');
end
[varargout{1:nargout}]=saveh5(varargin{:});
if(~isfield(opt,'rootname'))
if(nargin>=3 && ischar(varargin{1}))
opt.rootname=varargin{1};
else
opt.rootname=inputname(2);
end
end
[varargout{1:nargout}]=saveh5(varargin{2},filename, opt);
else
error('file suffix must be one of .json,.jnii,.jdt,.jmsh,.jnirs,.bjd,.bnii,.jdb,.bmsh,.bnirs,.ubj,.msgpack,.h5,.hdf5,.snirf');
end

0 comments on commit bed2366

Please sign in to comment.