Skip to content

Commit 50c461c

Browse files
author
fangq
committed
save 0x0 solid real empty array to null
git-svn-id: http://svn.code.sf.net/p/iso2mesh/code/trunk/jsonlab@468 786e58fb-9377-0410-9ff7-e4ac0ac0635c
1 parent dc4f0e7 commit 50c461c

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

examples/jsonlab_basictest.matlab

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,7 @@ json2data =
281281
ans =
282282

283283
{
284-
"empty_0by0_real": {
285-
"_ArrayType_": "double",
286-
"_ArraySize_": [0,0],
287-
"_ArrayData_": null
288-
}
284+
"empty_0by0_real": null
289285
}
290286

291287

savejson.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
sep=ws.sep;
303303

304304
if(length(size(item))>2 || issparse(item) || ~isreal(item) || ...
305-
isempty(item) ||jsonopt('ArrayToStruct',0,varargin{:}))
305+
(isempty(item) && any(size(item))) ||jsonopt('ArrayToStruct',0,varargin{:}))
306306
if(isempty(name))
307307
txt=sprintf('%s{%s%s"_ArrayType_": "%s",%s%s"_ArraySize_": %s,%s',...
308308
padding1,nl,padding0,class(item),nl,padding0,regexprep(mat2str(size(item)),'\s+',','),nl);

0 commit comments

Comments
 (0)