File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 106106 double_struct = struct ;
107107 double_struct.ndarray = 1 ;
108108 value = double(value );
109- if isreal(value )
109+ if isreal(value )
110110 double_struct.data = base64encode(typecast(value(: ), ' uint8' ));
111111 else
112112 double_struct.real = base64encode(typecast(real(value(: )), ' uint8' ));
142142 obj .put(dump_data_(value{i }, options ));
143143 end
144144 elseif isnumeric(value )
145- if isreal(value )
145+ if ~isfinite(value )
146+ json_non_finite = struct ;
147+ json_non_finite.json_non_finite = lower(num2str(value ));
148+ obj = dump_data_(json_non_finite , options );
149+ elseif isreal(value )
146150 obj = value ;
147- % Encode complex number as a struct
151+ % Encode finite complex number as a struct
148152 else
149153 complex_struct = struct ;
150154 complex_struct.real = real(value );
158162 keys = fieldnames(value );
159163 for i = 1 : length(keys )
160164 try
161- obj .put(keys{i },dump_data_(value.(keys{i }), options ));
165+ obj .put(keys{i }, dump_data_(value.(keys{i }), options ));
162166 catch ME
163167 obj .put(keys{i }, dump_data_(ME .message , options ))
164168 end
Original file line number Diff line number Diff line change 1- function json_response = pymat_eval(req );
1+ function json_response = pymat_eval(req )
22% PYMAT_EVAL: Returns a json object of the result of calling the function
33%
44% json_response = pymat_eval(req);
Original file line number Diff line number Diff line change @@ -108,6 +108,8 @@ def decode_pymat(dct):
108108 return data .reshape (shape , order = 'F' )
109109 elif 'real' in dct and 'imag' in dct :
110110 return complex (dct ['real' ], dct ['imag' ])
111+ elif 'json_non_finite' in dct :
112+ return float (dct ['json_non_finite' ])
111113 return dct
112114
113115MATLAB_FOLDER = '%s/matlab' % os .path .realpath (os .path .dirname (__file__ ))
You can’t perform that action at this time.
0 commit comments