簡體   English   中英

Matlab到LaTeX的文本和圖解

[英]Text and Plots in Matlab to LaTeX

我喜歡在Matlab中創建一個“報告生成”腳本。

假設我們有一個Matlab數組, data ,我們想將以下內容導出到.tex文件:“數據的第一個元素中的信息是X.” 接下來是X的情節。

我已經在Matlab中嘗試過help latex並且知道Matlab文件交換上的各種包。 但是到目前為止我還沒有看到任何內容,這樣我就可以將同一個Matlab腳本中的文本和繪圖導出到.tex文件中。

發布功能可能適合您。

創建這個腳本, foo.m

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

plot(X)

並將其發布到LaTeX:

>> publish foo latex

你知道matlab2tikz嗎? 我已將它廣泛用於我的博士論文,盡管僅用於出口單一地塊。 但我想應該很容易就可以扼殺一些能夠結合MATLABs LaTeX導出功能的東西。

您可能想看看在TUGboat(TeX Users Group的官方雜志)上發表的這篇文章:

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

通過Matlab生成LaTeX文檔(SE Talole和SB Phadke)

祝好運!

將數據從Matlab導出到.tex文件只需將圖形導出為適當的格式,然后將圖形文件包含在.tex文件中。 下面列出的代碼是否符合您的需求?

使用LaTeX生成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');

使用pdfTeX生成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');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM