MATLAB Answers

Jim Hokanson

Determine row height uitable

Asked by Jim Hokanson
on 20 Dec 2011

Is it possible to determine the height of a row in a uitable? I'd like to change the size of my table to accommodate the # of rows I am displaying. I'd prefer to do this without resorting to getting the java object ...




No products are associated with this question.

2 Answers

Answer by Walter Roberson
on 20 Dec 2011

If you are talking about a sort of equivalent to Extent for a single cell or single row, then No, there is no (documented) MATLAB mechanism for determining that. There is an Extent for the uitable as a whole, and a Position for the uitable, but if the Extent is bigger than the Position then one or more rows is not visible (and there is a scroll-bar to access it.) I was not able to determine the number of visible rows.

Now, doing this in Java is probably a different matter. See for all kinds of goodies.


Answer by Yair Altman
on 20 Dec 2011

Use findjobj to get the uitable's underlying Java JTable reference, and then simply do:

height = jtable.getRowHeight();

or if you are using different heights for different rows, then:

heights = jtable.getRowHeights();

More on stuff like this in my Matlab-Java programming book.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!