Skip to content

Commit

Permalink
avoid typecast error
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Apr 28, 2019
1 parent c166aa7 commit 804115b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions savejson.m
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@
if(~isempty(dozip) && numel(item)>zipsize)
if(isreal(item))
fulldata=item(:)';
if(islogical(fulldata))
fulldata=int32(fulldata);
end
else
txt=sprintf(dataformat,txt,padding0,'"_ArrayIsComplex_": ','1', sep);
fulldata=[real(item(:)) imag(item(:))];
Expand Down
3 changes: 3 additions & 0 deletions saveubjson.m
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@
if(~isempty(dozip) && numel(item)>zipsize)
if(isreal(item))
fulldata=item(:)';
if(islogical(fulldata))
fulldata=int32(fulldata);
end
else
txt=[txt,N_('_ArrayIsComplex_'),'T'];
fulldata=[real(item(:)) imag(item(:))];
Expand Down

0 comments on commit 804115b

Please sign in to comment.