【问题标题】:Matlab: Save jpg Files Under Plot Title NameMatlab:在绘图标题名称下保存 jpg 文件
【发布时间】:2013-05-16 19:56:48
【问题描述】:

在 MATLAB 中,我有一组简单的绘图,标题显示:

  Indiana
  Montana 
  Texas
  Arizona

我需要获取这些图,并按 TITLE 名称将图保存为 jpg 文件,保存在名为 States 的文件夹中:

 Folder:States
 Indiana.jpg
 Montana.jpg
 Texas.jpg
 Arizona.jpg

谢谢,

阿曼达

【问题讨论】:

  • 你试过MATLAB中的print函数吗?

标签: matlab plot save


【解决方案1】:

以下代码将保存所有当前打开的图形,并将其标题作为文件名。

figHandles = get(0,'Children'); % gets the handles to all open figure

for f = figHandles'
    axesHandle = get(f,'Children'); % get the axes for each figure
    titleHandle = get(axesHandle(1),'Title'); % gets the title for the first (or only) axes)
    text = get(titleHandle,'String'); % gets the text in the title
    saveas(f, text, 'jpg') % save the figure with the title as the file name 
end

【讨论】:

  • 非常感谢。我一直在使用无花果手柄,但无法找到解决方案。
猜你喜欢
  • 1970-01-01
  • 2011-12-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-05
  • 2019-12-07
  • 1970-01-01
相关资源
最近更新 更多