5

I am trying to plot a matlab figure in latex file. so i use this matlab2tikz function.

It works really well, until I try to add some customised text on the figure before converting it to tikz file, and when I try to build my latex file, it say error something like

Package pgfplots Error: the arguments of [mesh/rows=2,mesh/cols=0] assume 0 p 
oints, but I got actually N = 1 points! The data matrix appears to be incomplete

The problem is gone when I remove the text from the matlab file.

Can anyone help me?

I can't provide the real data here since it's too long, but I can give you an example.

Imagine I am plotting this

syms x
ezplot(sin(6*x))

Then, once it is plotted in the matlab, I go to Insert>Text Box and add some text on the figure.

Then, I will run this code

matlab2tikz('test.tikz', 'height', '\figureheight', 'width', '\figurewidth')

However, when I put this code in latex

\begin{figure} [H]
\centering
\input{Chapter4/Figs/test.tikz}
\caption[Surface force calibration]{Surface force calibration with small loads (100g, 200g and 300g)} 
\label{fig:irfan} 
\end{figure}

it is saying the error.

Sharah
  • 371
  • 1
    When a text box is included in the Matlab figure, I get the following message from matlab2tikz: Warning: Don't know class 'scribe.textbox'. Default handling. Comparing the output of the function with and without a text box, it seems that the default handling goes wrong. For example, I don't see why a textbox would be drawn as a three dimensional plot with \addplot3. The text of the box is not included in the .tikz file, either. I suggest checking https://github.com/nschloe/matlab2tikz/issues and filing a feature request / bug report if the issue has not been reported yet. – mvkorpel Aug 08 '14 at 13:05
  • For the record, the beginning of my pgfplots error message is the same as yours. The message continues: or overcomplete!? [Use mesh/check=false to disable this message]. – mvkorpel Aug 08 '14 at 13:17
  • 4
    That 'Don't know class 'scribe.textbox'` warning crops up as part of #175 Cannot export a loglog plot to tikz. But a separate issue probably needs to be created there. – Mike Renfro Aug 08 '14 at 14:05
  • @MikeRenfro it didnot mention how to solve it, and I asked question there but gets no reply. can anyone help me please – Sharah Aug 12 '14 at 10:48
  • The solution is to file a bug with the matlab2tikz author on GitHub about this specific problem. – Mike Renfro Aug 12 '14 at 12:18
  • 1
    You could try circumventing the issue by not adding the text on the Matlab side, but by editing the .tikz file produced by matlab2tikz and manually adding a text label. See Annotating a pgfplots graph – mvkorpel Aug 12 '14 at 12:35
  • 3
    I'm voting to close this question as off-topic because it is about a bug in matlab2tikz. – Torbjørn T. Feb 07 '15 at 22:03

0 Answers0