In the code generated by matlab2tikz, I am having a problem compiling the code. The error that I get is:
! Missing } inserted.
<inserted text>
}
I am not seeing in the code where the error is. The brackets look correct.
Can you please help me get this matlab2tikz code to complie? Thank you!
Here is the code:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{xcolor}
%% the following commands are needed for some matlab2tikz features
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows.meta}
\usepgfplotslibrary{patchplots}
\usepackage{grffile}
\usepackage{amsmath}
\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
%% you may also want the following commands
\pgfplotsset{plot coordinates/math parser=false}
%\newlength\figureheight
%\newlength\figurewidth
\begin{document}
% This file was created by matlab2tikz.
%
%The latest updates can be retrieved from
% http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz
%where you can also make suggestions and rate matlab2tikz.
%
%\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
%
\begin{tikzpicture}
\begin{axis}[%
width=4.396in,
height=1.713in,
at={(0.883in,2.125in)},
scale only axis,
separate axis lines,
every outer x axis line/.append style={white!40!black},
every x tick label/.append style={font=\color{white!40!black}},
every x tick/.append style={white!40!black},
xmode=log,
xmin=0.1,
xmax=10000,
xtick={0.1,1,10,100,1000,10000},
xticklabels={\empty},
xminorticks=true,
every outer y axis line/.append style={white!40!black},
every y tick label/.append style={font=\color{white!40!black}},
every y tick/.append style={white!40!black},
ymin=-150,
ymax=100,
ylabel={Magnitude (dB)},
axis background/.style={fill=white},
xmajorgrids,
xminorgrids,
ymajorgrids,
legend style={legend cell align=left, align=left, draw=white!15!black}
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1e-20 460\\
2e-16 373.97940008672\\
2e-11 273.97940008672\\
2e-07 193.97940008672\\
0.0002 133.97940008498\\
0.02 93.979382687181\\
0.2 73.9776604766519\\
0.233656357180521 72.6260737790347\\
0.272976466254357 71.2742556835082\\
0.318913433505023 69.9221218856437\\
0.372580755643581 68.5695574305924\\
0.435279310596225 67.2164056246064\\
0.508528890349814 65.8624529824047\\
0.594105040200952 64.5074088339076\\
0.694082097379708 63.1508777710172\\
0.810883472289793 61.7923225604558\\
0.947340391165627 60.4310144820835\\
1.10676052404865 59.0659673052162\\
1.29300816160207 57.6958503856501\\
1.51059788422311 56.3188758755282\\
1.76480399396087 54.9326552283403\\
2.06178836183266 53.5340218481269\\
2.40874978951507 52.1188211803692\\
2.8140985058872 50.6816786673865\\
3.28766002816376 49.215772040014\\
3.84091332914377 47.7126589387631\\
4.48726908366921 46.1622421642727\\
5.24239473889462 44.552983725662\\
6.12459428796224 42.8724842614997\\
7.15525195266944 41.1084954116539\\
8.35935052984777 39.2503059612158\\
9.76607696599646 37.2902568750356\\
11.4095298390967 35.2249825302553\\
13.3295458967289 33.0559683190839\\
15.5726656855012 30.7892160869787\\
18.1932616783216 28.4341294870657\\
21.2548562449431 26.001985060567\\
24.8316614129453 23.5044106916131\\
29.0103777424446 20.9521682657338\\
33.8922959186524 18.3543474238768\\
39.5957520041829 15.7179274647259\\
46.2589958656035 13.0475937242568\\
54.0435423039286 10.3456894891334\\
63.1380861193367 7.61221475935568\\
73.7630760099714 4.84482624825966\\
86.1760581745992 2.03883861986987\\
100.677919146268 -0.812727424497676\\
117.62017918116 -3.71896152579061\\
137.41351299195 -6.69062556953879\\
160.537704365387 -9.73934743987266\\
187.553275960699 -12.8764036780143\\
219.11507619125 -16.1111979370897\\
255.988152530899 -19.4497320625563\\
299.066296008708 -22.8934914466229\\
349.393706404331 -26.4391104664317\\
408.190303301183 -30.0789300868327\\
476.881296528833 -33.8022390929172\\
557.131732772255 -37.5967891245534\\
650.886855746185 -41.4501808203098\\
760.419258251686 -45.3508761893058\\
888.383969065015 -49.2887780321801\\
1037.88280994652 -53.2554439894443\\
1212.53958276194 -57.2440517919334\\
1416.58790922672 -61.2492268819669\\
1654.97385247943 -65.2668147050258\\
1933.47580799679 -69.2936486651507\\
2258.84456996598 -73.3273402158315\\
2638.96696827626 -77.3661015092111\\
3083.05704263578 -81.4086019010856\\
3601.87938781013 -85.453855160771\\
4208.01008379661 -89.5011325681274\\
4916.14153579409 -93.5498968898772\\
5743.43861318751 -97.5997527179224\\
6709.9547202367 -101.650409382183\\
7839.11788388376 -105.701653397379\\
9158.29864128477 -109.753328069761\\
10699.4734924696 -113.805318444481\\
12500 -117.857540217111\\
125000 -177.855818006582\\
12500000 -297.855800608783\\
12500000000 -477.855800607043\\
125000000000000 -717.855800607043\\
1e+20 -1072.04119982656\\
};
\addlegendentry{G}
\end{axis}
\begin{axis}[%
width=4.396in,
height=1.519in,
at={(0.883in,0.481in)},
scale only axis,
separate axis lines,
every outer x axis line/.append style={white!40!black},
every x tick label/.append style={font=\color{white!40!black}},
every x tick/.append style={white!40!black},
xmode=log,
xmin=0.1,
xmax=10000,
xminorticks=true,
every outer y axis line/.append style={white!40!black},
every y tick label/.append style={font=\color{white!40!black}},
every y tick/.append style={white!40!black},
ymin=-271.8,
ymax=-88.2,
ytick={-270, -180, -90},
ylabel={Phase (deg)},
axis background/.style={fill=white},
xmajorgrids,
xminorgrids,
ymajorgrids,
legend style={legend cell align=left, align=left, draw=white!15!black}
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1e-20 -90\\
2e-16 -90\\
2e-11 -90.0000000001192\\
2e-07 -90.0000011917522\\
0.0002 -90.0011917522137\\
0.02 -90.1191750685891\\
0.2 -91.1915994520071\\
0.233656357180521 -91.3920588370423\\
0.272976466254357 -91.6262132012483\\
0.318913433505023 -91.8997098208252\\
0.372580755643581 -92.2191326751401\\
0.435279310596225 -92.5921520073445\\
0.508528890349814 -93.0276942962854\\
0.594105040200952 -93.5361332938739\\
0.694082097379708 -94.1295012943638\\
0.810883472289793 -94.821717178047\\
0.947340391165627 -95.6288233669343\\
1.10676052404865 -96.5692167028282\\
1.29300816160207 -97.6638470972376\\
1.51059788422311 -98.9363409134281\\
1.76480399396087 -100.412981525118\\
2.06178836183266 -102.122445888259\\
2.40874978951507 -104.095153797879\\
2.8140985058872 -106.362041505682\\
3.28766002816376 -108.95253986257\\
3.84091332914377 -111.891553048939\\
4.48726908366921 -115.19535305449\\
5.24239473889462 -118.866594755154\\
6.12459428796224 -122.889151843887\\
7.15525195266944 -127.224090420932\\
8.35935052984777 -131.808541392855\\
9.76607696599646 -136.559043192485\\
11.4095298390967 -141.379779630612\\
13.3295458967289 -146.174305744534\\
15.5726656855012 -150.857805109704\\
18.1932616783216 -155.366677558834\\
21.2548562449431 -159.663487934238\\
24.8316614129453 -163.737170490962\\
29.0103777424446 -167.599795472136\\
33.8922959186524 -171.281657391288\\
39.5957520041829 -174.826123049704\\
46.2589958656035 -178.285044418623\\
54.0435423039286 -181.714955581377\\
63.1380861193367 -185.173876950296\\
73.7630760099714 -188.718342608712\\
86.1760581745992 -192.400204527864\\
100.677919146268 -196.262829509038\\
117.62017918116 -200.336512065762\\
137.41351299195 -204.633322441166\\
160.537704365387 -209.142194890296\\
187.553275960699 -213.825694255466\\
219.11507619125 -218.620220369388\\
255.988152530899 -223.440956807515\\
299.066296008708 -228.191458607145\\
349.393706404331 -232.775909579068\\
408.190303301183 -237.110848156113\\
476.881296528833 -241.133405244846\\
557.131732772255 -244.80464694551\\
650.886855746185 -248.108446951061\\
760.419258251686 -251.04746013743\\
888.383969065015 -253.637958494318\\
1037.88280994652 -255.904846202121\\
1212.53958276194 -257.877554111741\\
1416.58790922672 -259.587018474882\\
1654.97385247943 -261.063659086572\\
1933.47580799679 -262.336152902762\\
2258.84456996598 -263.430783297172\\
2638.96696827626 -264.371176633066\\
3083.05704263578 -265.178282821953\\
3601.87938781013 -265.870498705636\\
4208.01008379661 -266.463866706126\\
4916.14153579409 -266.972305703715\\
5743.43861318751 -267.407847992655\\
6709.9547202367 -267.78086732486\\
7839.11788388376 -268.100290179175\\
9158.29864128477 -268.373786798752\\
10699.4734924696 -268.607941162958\\
12500 -268.808400547993\\
125000 -269.880824931411\\
12500000 -269.998808247786\\
12500000000 -269.999998808248\\
125000000000000 -269.999999999881\\
1e+20 -270\\
};
\addlegendentry{G}
\end{axis}
\begin{axis}[%
width=4.521in,
height=3.566in,
at={(0.758in,0.481in)},
scale only axis,
xmin=0,
xmax=1,
xtick={\empty},
xlabel={Frequency (rad/s)},
ymin=0,
ymax=1,
ytick={\empty},
axis line style={draw=none},
ticks=none,
title style={font=\bfseries},
title={Bode Diagram},
axis x line*=bottom,
axis y line*=left,
legend style={legend cell align=left, align=left, draw=white!15!black}
]
\end{axis}
\end{tikzpicture}%
\end{document}

matlab2tikzor it was due to a manual edit? Because in the first case it would be nice to make a bug report. – Rmano Oct 18 '18 at 14:48