Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Best method for saving figures at given location, in given format etc. ?

조회 수: 1 (최근 30일)
A Lotgering
A Lotgering 2015년 12월 16일
마감: MATLAB Answer Bot 2021년 8월 20일
Dear all,
What is the best way to save a generated plot exactly the same as it is shown on my screen? The following code is used:
figure(3)
hist(F_RB(1,:),60)
grid on;
grid minor;
h = findobj(gca,'Type','patch');
h.FaceColor = [0 0.5 0.5];
h.EdgeColor = 'w';
title('Ridge Building','FontSize',14','FontWeight','Bold')
ylabel('Frequency','FontSize',13')
xlabel('Force [MN]','FontSize',13')
set( gcf, 'Color', 'White', 'Unit', 'pixels','Position', [0 0 600 300] );
set( gcf, 'Color', 'White', 'PaperUnits', 'points','PaperPosition', [0 0 300 150] );
figname = 'Ridge_building';
saveas(figure(3),fullfile(folder, figname), 'jpeg');
Problem is the difference in lay out. I'm struggling with the paper units. Pixels are not allowed.
Is there a better way to do this than the saveas command?

답변 (1개)

Naty S
Naty S 2015년 12월 16일
You might want to use the get function to get your screen size.
scrsz = get(0,'ScreenSize');
fig_handle=figure('Position',[1 1 scrsz(3)/2 scrsz(4)*0.93])

Community Treasure Hunt

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

Start Hunting!

Translated by