How to centre UITABLE in a figure? How to get the uitable reference?

4 views (last 30 days)
Hi,
I have 2 questions
1)
I am defining the full screen size of the figure using
f = figure('units','normalized','outerposition',[0 0 0.95 0.8]);
and then defining an uitable. is there direct way I can centre the UITABLE into the defined figure. I can try using the position property and with trail and error i can find the centre position. Is there any other way to do this.
2)
How to get the address of each cell data in a uitable, If I have a 4x4 matrix how to get the reference of 2x2 cell (2nd row, 2nd column).
Appreciate your help
Regards
Karthiik

Accepted Answer

Walter Roberson
Walter Roberson on 25 Jun 2012
1) There is no direct way to center a uitable.
You can use Normalized units for the uitable position and give the position in a symmetric way, [X Y 1-X 1-Y]
If you know the size of the table you want in pixels, then you can get() the Position of the containing figure and calculate the position that leaves equal margins on the two sides. As you created the figure with normalized units, you will need to temporarily change the figure units to Pixels, get() the Position, and switch the figure units back to normalized.
2) No mechanism is provided for determining the screen location of a particular cell in a uitable (though you might be able to do something at the Java level.) The cells also do not have individual handles. The only official access you have to the cells is to get() the Data property of the uitable, which will return a cell array.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!