How to adjust matlab figure size to powerpoint

55 ビュー (過去 30 日間)
Amine Aboufirass
Amine Aboufirass 2017 年 5 月 5 日
回答済み: Chaitral Date 2017 年 5 月 9 日
Currently I am outputting figures from matlab to the current directory using the following short script:
plot(1:10) % Example graph
set(gcf,'PaperUnits','centimeters','PaperPosition',[0 0 12 12])
print -djpeg filename.jpg -r200
Then I am copying this jpeg output into powerpoint to see the effects of modifying -r200 and/or the last argument of the set() function, namely 12 and 12.
What I am noticing is that changing from r100 to r200 does increase the resolution but it also increases the image size when I paste into powerpoint. Setting the image size using the set() function also changes the size but not as expected. For example the above produced an image in Powerpoint which was indeed square but not recognized by powerpoint as 12cm x 12cm. Powerpoint recognized it as being 16.7 cm by 16.7 cm.
I need to produce an image that Powerpoint recognizes as EXACTLY being 12 cm by 12 cm. How do I do this please?

回答 (1 件)

Chaitral Date
Chaitral Date 2017 年 5 月 9 日
Set the 'PaperPosition' and 'resolution' properties for the figure as given below to get the image size exactly as 12x12 cm in powerpoint.
set(gcf,'PaperUnits','centimeters','PaperPosition',[0 0 11.5 11.5]);
print -djpeg filename.jpg -r100;
I hope this helps.

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by