Skip to content

Commit 6cbc53a

Browse files
committed
Inf fix 2 - Inf and NaN is numeric
1 parent 36b286e commit 6cbc53a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

plotly/plotly_aux/m2json.m

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
if length(val)>1
2121
valstr = ['[' valstr ']'];
2222
end
23+
valstr = strrep(valstr, 'Inf', 'null');
24+
valstr = strrep(valstr, 'NaN', 'null');
2325
elseif ischar(val)
2426
valstr = ['"' val '"'];
2527
elseif islogical(val)
@@ -28,10 +30,6 @@
2830
else
2931
valstr = 'false';
3032
end
31-
elseif isinf(val)
32-
valstr = 'null'
33-
elseif isnan(val)
34-
valstr = 'null'
3533
else
3634
valstr = ''; % wtf is it?
3735
end

0 commit comments

Comments
 (0)