@Mark Mikofski Definitely a good idea to add this.

02 Nov 2013

matlab2tikz
A script to convert MATLAB/Octave into TikZ figures for easy and consistent inclusion into LaTeX.
Author: Nico Schlömer

@Anfänger Sounds like a bug. If you want it fixed, file a report at <https://github.com/nschloe/matlab2tikz/issues?state=open> with a minimal MATLAB example that highlights the misbehavior.

28 Oct 2013

matlab2tikz
A script to convert MATLAB/Octave into TikZ figures for easy and consistent inclusion into LaTeX.
Author: Nico Schlömer

@lyxicon

1. There is the option 'extraAxisOptions'. If that doesn't work for you, you could file a bug at <https://github.com/nschloe/matlab2tikz/issues?state=open>.

2. There's cleanfigure() to help you out.

3. That's possible, you're probably the first to use step/impulse plots with m2t. It'd be great if you could file a bug and provide minimal failing examples.

14 Aug 2013

matlab2tikz
A script to convert MATLAB/Octave into TikZ figures for easy and consistent inclusion into LaTeX.
Author: Nico Schlömer

@Maria Filing your problems at https://github.com/nschloe/matlab2tikz/issues?state=open with some minimal example code that highlights what goes wrong would make it much easier to fix the issues.

I experienced two issues, which I tried to solve with some hacking of the code (use with caution :)
(I am running R2013a and pdflatex)

1) multi-line legend entries:
Minimal working example: in matlab, run:
----
figure; plot(1:10, 1:10); legend(sprintf('This is a \n multiline legend entry'))
matlab2tikz('filename', 'm2ttest.tex', 'width', '0.8\columnwidth', 'height', '5cm')
----
In latex:
--header--
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfplotsset{plot coordinates/math parser=false}
\usetikzlibrary{plotmarks}
---after \begin{document}---
\begin{figure}
\input{m2ttest.tex}
\caption{TIKZ Test}
\end{figure}
----------------

Result: the legend entry appears in one line. There is a line break in m2ttest.tex which latex ignores.
My attempt to fix this:
a) change in function prettyPrint, line 4840 (see diff at bottom)
b) change in line 731 (see diff at bottom): add "[align=left]" to "\addlegendentry". Without this, my latex aborts with an error if a line break "\\" is used in the legend entry. I have seen that matlab2tikz sets the legend style to "legend cell align=left". Why the additional, explicit specification "align=left" is necessary is strange... maybe I am doing something wrong?

2) Positioning of the legend:
when I move the legend to, say, the bottom left of the figure (in the gui), it does not appear (exactly) at this position in latex. The problem seems to be that in matlab, the legend position is relative to the figure, while in tikzpicture, it is relative to the axis. Starting at line 3646, matlab2tikz seems to try to determine whether the matlab position is relative to figure or axis (unit = "normalized" or "pixel"). In my case, the unit is "normalized", but the position is still relative to the figure. So I just modified the script to always act as if the unit was "pixels" (copied the code from the "case 'pixels'" to the "case 'normalized'"). After that, legend positionig worked as expected.

What I modified in matlab2tikz.m:
diff matlab2tikz.m.orig matlab2tikz.m
713c713
< sprintf('\\addlegendentry{%s};\n\n', join(m2t, c, '\\'))]; %#ok
---
> sprintf('\\addlegendentry[align=left]{%s};\n\n', join(m2t, c, '\\'))]; %#ok
3646c3646,3651
< position = legendPos(1:2);
---
> %position = legendPos(1:2);
> % Calculate where the legend is located w.r.t. the axes.
> axesPos = get(m2t.currentHandles.gca, 'Position');
> % By default, the axes position is given w.r.t. to the figure,
> % and so is the legend.
> position = (legendPos(1:2)-axesPos(1:2)) ./ axesPos(3:4);
4840c4845,4848
<
---
> %now that all the character arrays in strings are 1-dimensional, we additionally need to split strings at newline characters
> strings = cellfun(@(x)strsplit(x, sprintf('\n')), strings, 'UniformOutput', false);
> strings = [strings{:}];
>

22 Jun 2014

matlab2tikz
A script to convert MATLAB/Octave into TikZ figures for easy and consistent inclusion into LaTeX.
Author: Nico Schlömer

Julia (http://www.julialang.com) is a new language that has the potential to be an alternative to MATLAB. It is targeted at MATLAB users, but it's speed approaches native C, is open-source (as in free beer) and has parallelism built in. Python has obviously been around longer, but Julia out performs Python by a order of magnitude.

Comment only