From: Hans on
Hi Everybody

Why is this code not showing the uitable? There is something wrong with the position and units?

fh=figure('name','Example',...
'numbertitle','off',...
'menubar','none',...
'color',[0.85, 0.85, 0.85],... %Change the color of the figure
'units','normalized',...
'position',[0.3, 0.7,0.4 0.2]); %Change the dimensions of the figure window

th = uitable('Data',magic(4),...
'position',[0.4 0.7 0.2 0.2]);

Best Regards

Hans
From: Andy on
"Hans " <jyde_6(a)msn.com> wrote in message <hi5bo0$1ts$1(a)fred.mathworks.com>...
> Hi Everybody
>
> Why is this code not showing the uitable? There is something wrong with the position and units?
>
> fh=figure('name','Example',...
> 'numbertitle','off',...
> 'menubar','none',...
> 'color',[0.85, 0.85, 0.85],... %Change the color of the figure
> 'units','normalized',...
> 'position',[0.3, 0.7,0.4 0.2]); %Change the dimensions of the figure window
>
> th = uitable('Data',magic(4),...
> 'position',[0.4 0.7 0.2 0.2]);
>
> Best Regards
>
> Hans

Try adding 'Units','Normalized' to the arguments of uitable.
From: Nathan on
On Jan 7, 11:13 am, "Hans " <jyd...(a)msn.com> wrote:
> Hi Everybody
>
> Why is this code not showing the uitable? There is something wrong with the position and units?
>
> fh=figure('name','Example',...
>     'numbertitle','off',...
>     'menubar','none',...
>     'color',[0.85, 0.85, 0.85],... %Change the color of the figure
>     'units','normalized',...
>     'position',[0.3, 0.7,0.4 0.2]); %Change the dimensions of the figure window
>
> th = uitable('Data',magic(4),...
>     'position',[0.4 0.7 0.2 0.2]);
>
> Best Regards
>
> Hans

You forgot to set the units of the uitable to normalized as well. The
default was in pixels.

fh=figure('name','Example',...
'numbertitle','off',...
'menubar','none',...
'color',[0.85, 0.85, 0.85],... %Change the color of the figure
'units','normalized',...
'position',[0.3, 0.7,0.4 0.2]); %Change the dimensions of the figure
window
th = uitable(fh,'Data',magic(4),... %assign the uitable as a child to
the figure
'units','norm',... %NORMALIZED UNITS
'position',[0.4 0.7 0.2 0.2]);

-Nathan
From: Andy on
For the record, the default units for uitables is pixels. So your initial table would have been awfully hard to read.
From: Hans on
"Andy " <theorigamist(a)gmail.com> wrote in message <hi5c72$65p$1(a)fred.mathworks.com>...
> For the record, the default units for uitables is pixels. So your initial table would have been awfully hard to read.


Thank you very much for your reply

Best Regards

Hans