Skip to content

Commit 804115b

Browse files
committed
avoid typecast error
1 parent c166aa7 commit 804115b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

savejson.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@
471471
if(~isempty(dozip) && numel(item)>zipsize)
472472
if(isreal(item))
473473
fulldata=item(:)';
474+
if(islogical(fulldata))
475+
fulldata=int32(fulldata);
476+
end
474477
else
475478
txt=sprintf(dataformat,txt,padding0,'"_ArrayIsComplex_": ','1', sep);
476479
fulldata=[real(item(:)) imag(item(:))];

saveubjson.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@
379379
if(~isempty(dozip) && numel(item)>zipsize)
380380
if(isreal(item))
381381
fulldata=item(:)';
382+
if(islogical(fulldata))
383+
fulldata=int32(fulldata);
384+
end
382385
else
383386
txt=[txt,N_('_ArrayIsComplex_'),'T'];
384387
fulldata=[real(item(:)) imag(item(:))];

0 commit comments

Comments
 (0)