Skip to content

Commit 6458287

Browse files
Merge branch 'patch-1' of https://github.com/amordoch/MATLAB-Online into amordoch-patch-1
2 parents bad2627 + 159ff0d commit 6458287

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plotly/plotly_aux/m2json.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@
2525
valstr = strrep(valstr, 'Inf', 'null');
2626
valstr = strrep(valstr, 'NaN', 'null');
2727
elseif ischar(val)
28-
val = checkescape(val); %add escape characters
29-
valstr = ['"' val '"'];
28+
[r, ~] = size(val);
29+
% We can't use checkescape() if we have ['abc'; 'xyz']
30+
if r > 1
31+
valstr = cell2json(cellstr(val));
32+
else
33+
val = checkescape(val); %add escape characters
34+
valstr = ['"' val '"'];
35+
end
3036
elseif islogical(val)
3137
if val
3238
valstr = 'true';

0 commit comments

Comments
 (0)