Skip to content

Commit 86ef12a

Browse files
committed
avoid error in matlab 2017a, close #34
1 parent 4a09ac3 commit 86ef12a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

savejson.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,8 @@
432432

433433
%%-------------------------------------------------------------------------
434434
function txt=matlabobject2json(name,item,level,varargin)
435-
if numel(item) == 0 %empty object
436-
st = struct();
437-
else
435+
st = struct();
436+
if numel(item) > 0 %non-empty object
438437
% "st = struct(item);" would produce an inmutable warning, because it
439438
% make the protected and private properties visible. Instead we get the
440439
% visible properties

saveubjson.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,8 @@
345345

346346
%%-------------------------------------------------------------------------
347347
function txt=matlabobject2ubjson(name,item,level,varargin)
348-
if numel(item) == 0 %empty object
349-
st = struct();
350-
else
348+
st = struct();
349+
if numel(item) > 0 %non-empty object
351350
% "st = struct(item);" would produce an inmutable warning, because it
352351
% make the protected and private properties visible. Instead we get the
353352
% visible properties

0 commit comments

Comments
 (0)