Effacer les filtres
Effacer les filtres

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

18 vues (au cours des 30 derniers jours)
Mark Golberg
Mark Golberg le 1 Sep 2020
Réponse apportée : Erica le 24 Oct 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 commentaire
Adam Danz
Adam Danz le 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.

Connectez-vous pour commenter.

Réponses (2)

Mario Malic
Mario Malic le 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 le 24 Oct 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;

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by