Normalize uifigure units in R2019b

Hi,
I have been trying to get the units of a uifigure to be set to normalized but cannot for the life of me find a way to do it.
On the uifigure documentation it only lists the units as being set as pixels
Would that mean that I cannot set the units of a uifigure, and subsequently children within it, to normalized? It seems like it should be possible to set the units to normalized given a standard figure can have normalized units.
Main reason for wanting to use a uifigure over a normal figure is just that the uitable that I'm putting in the figure has nicer styling in a uifigure than a normal figure and allows for highlighting of entire rows and columns with one click.
(code below)
Thanks!
LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
T = table(Age,Height,Weight,'RowNames',LastName);
% fig = uifigure; % toggle fig to be part of the script and in the properties of uitable (uitable(fig, .....))
uitable('Data',T{:,:},'ColumnName',T.Properties.VariableNames,...
'RowName',T.Properties.RowNames, 'Units', 'Normalized', 'Position', [0.1 0.1 0.8 0.8]);

답변 (1개)

Walter Roberson
Walter Roberson 2021년 1월 29일

0 개 추천

Would that mean that I cannot set the units of a uifigure, and subsequently children within it, to normalized?
It means that you cannot set the units of the uifigure() to Normalized, but you can still set the units of children of uifigure to be normalized.

댓글 수: 3

Hi,
That still seems to not work for me, I have pasted my updated sample code and the error messages i am getting. I get the same results defining the units in the uitable function.
LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
T = table(Age,Height,Weight,'RowNames',LastName);
fig = uifigure('Position', [100 100 500 500]);
uit = uitable(fig); %'Data',T{:,:},'ColumnName',T.Properties.VariableNames,...
% 'RowName',T.Properties.RowNames, 'Units', 'normalized', 'Position', [0.1 0.1 0.8 0.8]);
uit.Data = T{:,:};
uit.ColumnName = T.Properties.VariableNames;
uit.RowName = T.Properties.VariableNames;
uit.Units = 'normalized';
uit.Position = [0.1 0.1 0.8 0.8];
Walter Roberson
Walter Roberson 2021년 1월 29일
Your code works in MATLAB Online, which is running R2020b. Perhaps you are using an older release?
Tristan Thompson
Tristan Thompson 2021년 1월 29일
I am running R2019b so it could be a compatibiliy thing, very frustrating if it is.

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

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

질문:

2021년 1월 29일

댓글:

2021년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by