Need documentation for hgexport function
17 次查看(过去 30 天)
显示 更早的评论
After being introduced in R2007 even in R2016 there is very little documentation for the hgexport() function. Many different sources seem to use the function in numerous and different ways. Where can I find a comprehensive account of the many ways hgexport can be used? Specifically R2016 has a built in export settings called "Documents", "Presentations", "default". I would like to use the hgexport() function to load the Presentations style and apply it.
Trying
s = hgexport('readstyle','Presentations')
Seems to not help.
Error using hgexport
Style 'Presentations' does not exist.
Error in hgexport
0 个评论
回答(1 个)
Walter Roberson
2017-1-20
See ExportSetup https://www.mathworks.com/help/matlab/creating_plots/customize-figure-before-saving.html
hgexport('factorystyle') returns a built-in style.
exportsetupdlg.m checks the figure appdata 'Exportsetup' property to see if a style has been applied to the figure. If not then it looks for default style information and if not it initializes with factorystyle.
The settings you are looking at, Documents and Presentations, do not exist until the exportsetupdlg initialization is run. Internally it uses the names MSWord and PowerPoint
The style information for MSWord and PowerPoint is looked for in prefdir subdirectory ExportSetup in files MSWord.txt and PowerPoint.txt . It will write them there if it does not find them. So you could customize those files.
MSWord style defaults to the same as factorystyle.
PowerPoint style defaults to bold scaled fontsize 140 with fixed width lines.
Look near lines 1450 in exportsetupdlg.m
hgexport() can also be called with a figure, then a filename, then a style, then 'Format', then the name of one of the supported formats. The supported formats are extracted from the printtables() command which uses information about what is locally available. Look starting at roughly line 350 in filemenufcn.m
1 个评论
Allen Goldstein
2021-1-21
If you want to use the screen resoluton, you need to change the resolution to 0.
style = hgexport('factorystyle'); % get the style
style.Resolution = 0; % Resolution = 0 means use the screen resolution
hgexport(gcf,'-clipboard',style);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Adding custom doc 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!