Can I freeze first row and/or column in uitable?

10 次查看(过去 30 天)
Hey,
can I freeze first row and/or first column in a uitable? Similar to what exist in excel - freeze pane.
Adding 2 uitables one on top of the other doesn't seems to work (scroll bar appears, etc... unless i'm doing it incorrectly).
I'm using Matlab 2015a.
Thanks for the help!
Mark
  1 个评论
Adam Danz
Adam Danz 2020-9-1
Matlab doesn't have an option like that.
I would suggest doing what you've already tried: create 2 tables: one for the column (or row) headers and one for the data. The scroll bar appears when the size of the uitable doesn't match the size of the data, I believe. So, your headers table should only have 1 row (or 1 column) of data.

请先登录,再进行评论。

回答(2 个)

Mario Malic
Mario Malic 2020-9-1
I am also not familiar with the freeze panel. To eliminate the scrolling effect in UITable, set your ColumnWidth values to desired width, and parameter Width in Position to be higher by 2 or 3 pixels than the total width. At least, this is what works in my case, maybe this is monitor resolution dependant.
Example: for a table with 5 columns and 50 pixel width each, Position should be [x y 253 h].

Erica
Erica 2023-10-24
It is not a perfect solution. However, you can use the RowName for 'freezing' the first column.
fig = uifigure;
T = uitable(fig);
M = magic(50);
T.Data = M;
T.RowName = M(:,1);
T.ColumnSortable = true;

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by