Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text and Plots in Matlab to LaTeX

I like to create a "report generation" script in Matlab.

Suppose we have a Matlab array, data and we want to export the following to a .tex file: "The information in the first element of data is X." This would be followed by a plot of X.

I have already tried help latex in Matlab and aware of the various packages on Matlab file exchange. However I have seen nothing so far that will allow me to export both text and plots in the same Matlab script to a .tex file.

like image 789
Elpezmuerto Avatar asked Jul 12 '10 17:07

Elpezmuerto


3 Answers

The publish function may work for you.

Create this script, foo.m:

%%
% The information in the first element of data is X.

plot(X)

And publish it to LaTeX:

>> publish foo latex
like image 177
Matthew Simoneau Avatar answered Oct 05 '22 19:10

Matthew Simoneau


You might want to take a look at this article published in TUGboat (the official magazine of the TeX Users Group):

http://www.tug.org/TUGboat/Articles/tb24-2/tb77seta.pdf

Generating LaTeX documents through Matlab (S. E. Talole and S. B. Phadke)

Good luck!

like image 33
yCalleecharan Avatar answered Oct 05 '22 17:10

yCalleecharan


Are you aware of matlab2tikz? i've used it extensively for my PhD-Thesis, albeit only for exporting single plots. But I guess it should be easily possible to whip something up that combines the power of MATLABs LaTeX export capabilities.

like image 37
Habi Avatar answered Oct 05 '22 18:10

Habi