How can I print a figure with true scale

Hi, I am trying to printout a figure and I want that it will be 5cmX10cm When I run the code the figure I get on the screen is almost 5cmX10cm - But not precise and the figure I get in the PDF doc is 6.5cmX13 cm
I need that Plot to be 5cmX10cm precise, what I need to change in my code?
Many thanks.
My code is:
Width=5
Height=10
s=num2str(Number);
filename= [s 'Pic'];
pic=Picture(Mask);
axis off
set(gca,'units','centimeters')
set(gca,'xlimmode','manual','ylimmode','manual')
axpos = get(gca,'position')
set(gca,'position',[axpos(1:2) Width Height])
set(gcf, 'PaperUnits', 'centimeters')
print(filename, '-dpdf' , '-r0')

2 Comments

Stephen23
Stephen23 on 29 Jul 2016
Edited: Stephen23 on 29 Jul 2016
@Yuvall Larom: please don't post duplicate questions:
You can simply edit your existing question.
Stephen23
Stephen23 on 29 Jul 2016
Edited: Stephen23 on 29 Jul 2016
If you really want to specify the exact image size in a document, then this is possible with TeX to a precision unmatched by any other tool:
and so presumably also with LaTeX and tikz.

Sign in to comment.

Answers (1)

Asked:

on 29 Jul 2016

Answered:

on 29 Jul 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!