필터 지우기
필터 지우기

is there a way that matlab can automatically change the font size of a figure, when the user changes the figure size?

조회 수: 23 (최근 30일)
my program changes the figure size through the command:
set(gcf,'paperunits','centimeters');
set(gcf,'paperposition',[1 1 a(1) a(1)*(1/a(2))]);
is there anyway that matlab can change the figure font size automatically?

채택된 답변

Walter Roberson
Walter Roberson 2014년 1월 16일
That code does not change the figure size: it changes the output size for printing purposes.
When a figure is submitted for printing, normally it is resized. That resize can be detected through a figure callback, which can change any property it likes.
There is no MATLAB "change all font sizes" command, but you can findall() of property 'fontsize' and operate on those objects.
I found in my programming that it was common to have a mix of font sizes in a figure. To avoid having to keep track of the sizes individually, I set a property on each text object to reflect the relative font size, such as "+1" for an object with a large font size. I could then search for objects with that property and do relative changes, and afterwards when resizing back down after printing, I could re-adjust appropriately. I happened to use part of the Tag property for this purpose, but you could use UserData.
  댓글 수: 1
Mohammad
Mohammad 2014년 1월 16일
Thank you! I think you are the lord of matlab! but the problem is, that the figures are so different from eachother that I can't predict the possible situations.On the other hand the user gives the figur to the program!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 1월 16일
When you create the controls, either in GUIDE or with uicontrol(), set the "units" property to "normalized". It will then scale the GUI proportionally as you drag the window larger or smaller.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by