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

23 ビュー (過去 30 日間)
Mark Golberg
Mark Golberg 2020 年 9 月 1 日
回答済み: Erica 2023 年 10 月 24 日
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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by