Filter löschen
Filter löschen

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

18 Ansichten (letzte 30 Tage)
Mark Golberg
Mark Golberg am 1 Sep. 2020
Beantwortet: Erica am 24 Okt. 2023
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 Kommentar
Adam Danz
Adam Danz am 1 Sep. 2020
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.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Mario Malic
Mario Malic am 1 Sep. 2020
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 am 24 Okt. 2023
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;

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by