Sebastian February 2016

Save matlab plot as EMF-file in specific size

I tried the following script in Matlab 2014b and 2015a, but the size of the EMF-file is not satisfactory:

fig = figure; bode(1/tf('s'));
set(fig,'PaperPositionMode','auto');
set(fig, 'Position', [0 0 400 300]);
print(fig,'test1','-dpng','-r0','-loose'); % here the result is a picture with 300 x 400 ->ok
print(fig,'test2','-dmeta','-r0','-loose'); % here the size is 215,19 x 286,69 -> not ok

I tried also to use:

set(fig,'PaperUnits','points','PaperPosition',[0 0 400 300])

But it does not change anything. It makes also no difference if '-loose' is used or not. Where is my mistake?

Edit: Can someone test the script in Matlab 2015b or 2013b?

Remark: Someone claimed that an EMF-graphic has not a size. It has one, because it is designed for printers where you exactly specifiy the size how it is printed.

Thanks for your help.

Answers


Alessiox February 2016

set() behaviour changes whether you have multiple figures on screen.

I am on Mac, so I can't save EMF files, but since you saved fig, try set() with fig and not with gcf as first argument.

gcf is get current figure so if you have multiple figures on-screen you should pay attention. Although by saving the figure handle, there's nothing to worry about.

Post Status

Asked in February 2016
Viewed 3,977 times
Voted 7
Answered 1 times

Search




Leave an answer