matlab assign a "export settings" -> "load settings from" for figures programmatically
matlab
Solution
I found this solution at the bottom of this thread:
% create an example fig that we want to format with style file 'foo'
plot(rand(14,10));
% get style sheet info
snam='foo'; % The name of your style file (NO extension)
s=hgexport('readstyle',snam);
%apply style sheet info
fnam='myfig.jpeg'; % your file name
s.Format = 'jpeg'; %I needed this to make it work but maybe you wont.
hgexport(gcf,fnam,s);
And in your current folder should be a file called "myfig.jpeg" that is your figure with the export settings you made in "foo". If you want to see the style file options, type `s` into the command line. It should be a struct like this with all your export settings in it.
s =
Version: '1'
Format: 'jpeg'
Preview: 'none'
Width: 'auto'
Height: 'auto'
Units: 'points'
Color: 'rgb'
Background: 'w'
FixedFontSize: '10'
ScaledFontSize: 'auto'
FontMode: 'scaled'
FontSizeMin: '8'
FixedLineWidth: '1'
ScaledLineWidth: 'auto'
LineMode: 'scaled'
LineWidthMin: '2'
FontName: 'Wingdings'
FontWeight: 'auto'
FontAngle: 'auto'
FontEncoding: 'latin1'
PSLevel: '2'
Renderer: 'auto'
Resolution: 'auto'
LineStyleMap: 'none'
ApplyStyle: '0'
Bounds: 'loose'
LockAxes: 'on'
ShowUI: 'on'
SeparateText: 'off'
Problem
I have some figure styles I have saved in the "export settings" dialog that is accessed under File->"Export Setup". Is there a way to load one of my styles programmatically? ie. I currently need to do a number of mouse clicks to load my desired style, then apply it to the figure, then tell it to export and give the file a name. I feel like all this should be doable through a few commands but I can't find the right information.