Matlab 中的文本和绘图到 LaTeX
我喜欢在 Matlab 中创建“报告生成”脚本。
假设我们有一个 Matlab 数组 data
并且我们想要将以下内容导出到 .tex 文件: “数据第一个元素中的信息是X。”接下来是 X 的图。
我已经在 Matlab 中尝试过 help Latex
并了解 Matlab 文件交换上的各种包。然而,到目前为止,我还没有看到任何东西可以让我将同一个 Matlab 脚本中的文本和绘图导出到 .tex 文件。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可能想看看发表在 TUGboat(TeX 用户组的官方杂志)上的这篇文章:
http://www.tug.org/TUGboat/Articles/tb24-2/tb77seta.pdf
通过 Matlab 生成 LaTeX 文档(SE Talole 和 SB Phadke)
祝你好运!
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!
发布功能可能适合您。
创建此脚本
foo.m
:并将其发布到 LaTeX:
The publish function may work for you.
Create this script,
foo.m
:And publish it to LaTeX:
您知道 matlab2tikz 吗?我在我的博士论文中广泛使用了它,尽管仅用于导出单个图。但我想应该很容易就能组合出 MATLAB LaTeX 导出功能的强大功能。
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.
将图形从 Matlab 导出到 .tex 文件只需将图形导出为适当的格式,然后将图形文件包含在 .tex 文件中。下面列出的代码可以满足您的需求吗?
使用LaTeX生成dvi:
使用pdfTeX生成pdf:
Exporting figures from Matlab to a .tex file is just a matter of exporting the figure to an appropriate format and then including the figure file in the .tex file. Would something like the code listed below work for your needs?
Using LaTeX to generate dvi:
Using pdfTeX to generate pdf: