Skip to content

Commit

Permalink
loadjson fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mobeets committed Jan 24, 2017
1 parent e8cca82 commit 39a43bf
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions loadjson_internal.m
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,41 @@ function error_pos(msg, inStr)
end
i=i+1;
end
%%-------------------------------------------------------------------------
function s=mergestruct(s1,s2)
%
% s=mergestruct(s1,s2)
%
% merge two struct objects into one
%
% authors:Qianqian Fang (q.fang <at> neu.edu)
% date: 2012/12/22
%
% input:
% s1,s2: a struct object, s1 and s2 can not be arrays
%
% output:
% s: the merged struct object. fields in s1 and s2 will be combined in s.
%
% license:
% BSD License, see LICENSE_BSD.txt files for details
%
% -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab)
%

if(~isstruct(s1) || ~isstruct(s2))
error('input parameters contain non-struct');
end
if(length(s1)>1 || length(s2)>1)
error('can not merge struct arrays');
end
fn=fieldnames(s2);
s=s1;
for i=1:length(fn)
s=setfield(s,fn{i},getfield(s2,fn{i}));
end


%%-------------------------------------------------------------------------
% license.txt
%%-------------------------------------------------------------------------
Expand Down

0 comments on commit 39a43bf

Please sign in to comment.