Skip to content

Commit 4a09ac3

Browse files
authored
Merge pull request #32 from vrichter/master
respect integer types
2 parents b5dec91 + e67d3a3 commit 4a09ac3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

savejson.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,11 @@
468468
txt='null';
469469
return;
470470
end
471-
floatformat=jsonopt('FloatFormat','%.10g',varargin{:});
471+
if(isinteger(mat))
472+
floatformat=jsonopt('FloatFormat','%d',varargin{:});
473+
else
474+
floatformat=jsonopt('FloatFormat','%.10g',varargin{:});
475+
end
472476
%if(numel(mat)>1)
473477
formatstr=['[' repmat([floatformat ','],1,size(mat,2)-1) [floatformat sprintf('],%s',nl)]];
474478
%else

0 commit comments

Comments
 (0)