Text and graphics in Matlab for LaTeX

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

Suppose we have a Matlab array dataand we want to export the following to a .tex file: “The information in the first data item is“ X. ”This will be followed by a graph of X.

I already tried help latexin Matlab and knew about the various Matlab file exchange packages. However, I have not seen anything so far, which will allow me to export text and graphics into the same Matlab script in a .tex file.

+5
source share
4 answers

, , TUGboat ( TeX):

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

LaTeX- Matlab (S. E. Talole S. B. Phadke)

!

+3

publish .

script, foo.m:

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

plot(X)

LaTeX:

>> publish foo latex
+4

matlab2tikz? , . , -, MATLABs LaTeX.

+3

Exporting shapes from Matlab to a .tex file is a matter of exporting the shapes to the appropriate format, and then including the drawing file in a .tex file. Would something like the code below work for your needs?

Using LaTeX to generate dvi:

% Include code to write text to .tex file (fid is assumed to be the file id of the .tex file)
print(gcf,'figure1','-depsc','-r100');
fprintf(fid,'\includegraphics[width=4in]{figure1.eps}\n');

Using pdfTeX to generate pdf:

% Include code to write text to .tex file (fid is assumed to be the file id of the .tex file)
print(gcf,'figure1','-djpg','-r100');
fprintf(fid,'\\includegraphics[width=4in]{figure1.jpg}\n');
0
source

All Articles