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]);

Answers (1)

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 Comments

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];
Your code works in MATLAB Online, which is running R2020b. Perhaps you are using an older release?
I am running R2019b so it could be a compatibiliy thing, very frustrating if it is.

Sign in to comment.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Asked:

on 29 Jan 2021

Commented:

on 29 Jan 2021

Community Treasure Hunt

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

Start Hunting!