Azzera filtri
Azzera filtri

Setting UI table size to start from the top row and have a scroll bar

2 visualizzazioni (ultimi 30 giorni)
Hello I am trying to plot data in a table but when I set it to size automatically, I lose my scroll bar and hence the ability to see data on top of the figure. The only way for me to do that is to increase my window size, which in this case is unreasonable. I want the output of this function to be a figure where the first row of the table is at the top and there is a scroll wheel on the right hand side.
clear;
figfig = figure('Name','Final Results','NumberTitle','off');clf;
X = rand(150,9);
XCell = cellstr(string(X));
A(1:150,1:9) = string("#FFFFFF");
A = cellstr(A);
outHtml = strcat('<html><table border=0 width=400 bgcolor=', ...
A, ... % Choose the appropriate color for each cell
'"><TR><TD>', ...
XCell, ... % Convert num data to cell of chars
'</TD></TR></body></html>');
u = uitable(figfig,'Data',outHtml);
table_extent = get(u,'Extent');
figure_size = get(figfig,'outerposition');
desired_fig_size = [figure_size(1) figure_size(2) table_extent(3)+15 table_extent(4)+65];
set(u,'outerposition',[1 1 table_extent(3) table_extent(4)])
set(figfig,'outerposition', desired_fig_size);
end

Risposta accettata

Greg
Greg il 19 Gen 2018
Not sure why you're using HTML here...
u = uitable(figfig,'Data',outHtml,'Units','normalized','OuterPosition',[0,0,1,1]);
Then remove the other lines dealing with the uitable size/position.

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by