File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
2
2
% WRITE_JSON Used to write structures for JSON files.
3
- %
4
- % NOTE: There is a known issue on Mac systems where logicals cannot be
5
- % written to the files. Omit the corresponding fields for those cases.
3
+ % NOTE: Saving large aggregate structures can be slow.
6
4
%
7
5
% AUTHOR: Timothy Sipkens
8
6
9
7
function [t2 ,t0 ] = write_json(var , fname )
10
8
11
9
fid = fopen(fname ,' wt' ); % open file, overwriting previous text
12
10
11
+ % Binary field of Aggs structure is sparse logical.
12
+ % Convert of logical, as sparse structure cannot be stored.
13
+ if isfield(var , ' binary' )
14
+ for ii= 1 : length(var )
15
+ var(ii ).binary = full(var(ii ).binary);
16
+ end
17
+ end
13
18
14
19
% -- Encode json ----------------------------------------------------------%
15
20
t0 = jsonencode(var ); % generate json text using built-in function
You can’t perform that action at this time.
0 commit comments