Skip to content

Commit 934cf42

Browse files
committed
MATLAB to JSON bug - now handles Inf and NaN
1 parent e1cbf75 commit 934cf42

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plotly/plotly_aux/m2json.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828
else
2929
valstr = 'false';
3030
end
31+
elseif isinf(val)
32+
valstr = 'null'
33+
elseif isnan(val)
34+
valstr = 'null'
3135
else
3236
valstr = ''; % wtf is it?
33-
end
34-
valstr = strrep(valstr, 'Inf', 'null');
35-
valstr = strrep(valstr, 'NaN', 'null');
37+
end

0 commit comments

Comments
 (0)